From 349aed4aaf0576101d034add1ffc492b2fa7354c Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Mon, 12 Nov 2018 17:33:42 -0500 Subject: [PATCH] Fix null pointer crash when lua script fails to load. --- src/lua-engine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index f1b97ebd..7fb11b3a 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -6015,7 +6015,8 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) { #endif // Wipe the stack. Our thread - lua_settop(L,0); + if (L) + lua_settop(L,0); return 0; // Oh shit. } #ifdef WIN32