Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException occurs when printing after breaking out of a loop using goto in an if statement #309

Open
user32121 opened this issue Aug 5, 2022 · 0 comments

Comments

@user32121
Copy link

user32121 commented Aug 5, 2022

lua script:
(edit: simplified lua script)

if true then
	for x = 1, 10 do
		goto label1
	end
	::label1::
end
print("test")

stacktrace (from REPL):

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at MoonSharp.Interpreter.Execution.VM.Processor.Processing_Loop(Int32 instructionPtr) in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Execution\VM\Processor\Processor_InstructionLoop.cs:line 201
   at MoonSharp.Interpreter.Execution.VM.Processor.Call(DynValue function, DynValue[] args) in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Execution\VM\Processor\Processor.cs:line 67
   at MoonSharp.Interpreter.Script.DoFile(String filename, Table globalContext, String codeFriendlyName) in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Script.cs:line 362
   at MoonSharp.Commands.Implementations.RunCommand.Execute(ShellContext context, String arguments) in Z:\git\my\moonsharp\src\MoonSharp\Commands\Implementations\RunCommand.cs:line 33
   at MoonSharp.Program.ExecuteCommand(ShellContext shellContext, String cmdline) in Z:\git\my\moonsharp\src\MoonSharp\Program.cs:line 211
   at MoonSharp.Program.InterpreterLoop(ReplInterpreter interpreter, ShellContext shellContext) in Z:\git\my\moonsharp\src\MoonSharp\Program.cs:line 70
   at MoonSharp.Program.Main(String[] args) in Z:\git\my\moonsharp\src\MoonSharp\Program.cs:line 47
@user32121 user32121 changed the title NullReferenceException occurs when printing an uninitialized global variable after breaking out of a loop using goto NullReferenceException occurs when printing an uninitialized global variable after breaking out of a loop using goto in an if statement Aug 5, 2022
@user32121 user32121 changed the title NullReferenceException occurs when printing an uninitialized global variable after breaking out of a loop using goto in an if statement NullReferenceException occurs when printing after breaking out of a loop using goto in an if statement Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant