From 0f9d3732fb8c09cbc1e7dd532a8f8ff2a9b8decd Mon Sep 17 00:00:00 2001 From: sammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 11 May 2021 18:59:54 -0400 Subject: [PATCH] fix: check if type assertion of return value is valid --- shell.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell.go b/shell.go index 3ae8349..86750be 100644 --- a/shell.go +++ b/shell.go @@ -60,8 +60,8 @@ func RunInput(input string) { l.Pop(1) - if luaexitcode != lua.LNil { - exitcode = luaexitcode.(lua.LNumber) + if code, ok := luaexitcode.(lua.LNumber); luaexitcode != lua.LNil && ok { + exitcode = code } if err != nil { fmt.Fprintln(os.Stderr,