mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
LuaContext: don't run console commands without a Lua state
Init() only runs on game load and Shutdown() nulls lua_ back out, but ImDebugger::Frame draws the Lua console outside its PSP_IsInited() block, and whether the console is open is persisted config. So opening it, exiting to the menu, and typing anything other than the built-in clear/help/history dereferenced null.
This commit is contained in:
1 parent
98e8ffe7cd
commit
bcd4f7e653
1 file changed
+8
@@ -98,6 +98,14 @@ void LuaContext::Print(LogLineType type, std::string_view text) {
|
||||
}
|
||||
|
||||
void LuaContext::ExecuteConsoleCommand(std::string_view cmd) {
|
||||
if (!lua_) {
|
||||
// Init() only runs on game load and Shutdown() nulls this back out, but the ImDebugger draws
|
||||
// the Lua console outside its PSP_IsInited() check - and whether it's open is persisted
|
||||
// config, so it can be up with no game loaded at all.
|
||||
Print(LogLineType::Error, "No Lua state - load a game first.");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Also rewrite expressions like:
|
||||
// print "hello"
|
||||
// to
|
||||
|
||||
Reference in new issue
Block a user