diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index 854f3ddfeead9efcde3ec86393984ac47564b18b..5cfd1bd3d461f49e774593dd87f0daac77ee08e1 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -1793,4 +1793,6 @@ void LUAh_GameQuit(void)
 			hookp->error = true;
 		}
 	}
-}
\ No newline at end of file
+	
+	lua_pop(gL, 1); // Pop error handler
+}