LarryO Posted July 19, 2022 Share Posted July 19, 2022 (edited) HandletoObject1 := FunctionThatCreates3DObject(parameter1); HandletoObject2 := FunctionThatCreates3DObject(parameter2); Move3DObj(HandletoObject2, 100, 0, 0); The parameter sent to the second call of FunctionThatCreates3DObject does not generate a 3D object and therefore does not return a handle to the variable. The call to Move3DObj(); with no value assigned into the handle variable HandletoObject2 will move a 3D object that was created prior. Is NIL a valid handle result to test for? Or would this work-around only work due to a fluke of luck? IF (HandletoObject2<>NIL) THEN Move3DObj(HandletoObject2, 100, 0, 0); <edit> Actually it may not be a bug. The Function may still be assigned the value generated from the first call because the second call doesn't replace it due to the parameter in the second instance telling the function nothing is required of it. </edit> Edited July 19, 2022 by LarryO Quote Link to comment
Pat Stanford Posted July 19, 2022 Share Posted July 19, 2022 Yes, Handle <> Nil is a valid function. And necessary to bulletproof your code in case of an error that results in no object being defined by a handle. Quote Link to comment
LarryO Posted July 19, 2022 Author Share Posted July 19, 2022 Never mind, I found my bug. Anyone high enough authority can scrap this message.🙄 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.