moonsharp icon indicating copy to clipboard operation
moonsharp copied to clipboard

Returning null from callback invoked in CallbackFunction causes NullReferenceException

Open ThisIsNoZaku opened this issue 3 years ago • 0 comments

In Processor_InstructionLoop.cs, if the CLR function wrapped by a CallbackFunction returns null, that null is pushed on the value stack and the processor proceeds on to call Internal_CheckForTailRequests. In Internal_CheckForTailRequests, a check of the type is attempted, causeing a NullReferenceException to be thrown.

At the very least, I believe Internal_CheckForTailRequests should do a null check and give a explanatory message. A better solution, in my opinion, is that the null should cause Nil to be pushed onto the stack instead.

ThisIsNoZaku avatar Jul 04 '22 18:07 ThisIsNoZaku