diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-21 23:49:26 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-21 23:49:26 -0500 |
commit | 236a72a0a17d3532cfa040fbbc047259ec0cffe9 (patch) | |
tree | bdd9ff1d459cae0e9132b16ad8070ed94afb16f6 /src | |
parent | 9890cbf428b6216b05de02805c77c45d7b0983ab (diff) | |
download | tanetane-236a72a0a17d3532cfa040fbbc047259ec0cffe9.tar.gz tanetane-236a72a0a17d3532cfa040fbbc047259ec0cffe9.tar.bz2 tanetane-236a72a0a17d3532cfa040fbbc047259ec0cffe9.zip |
Entering an invalid debug command fails gracefully
Diffstat (limited to 'src')
-rw-r--r-- | src/script_system.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script_system.cpp b/src/script_system.cpp index c7c3938..769a872 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -235,6 +235,11 @@ void ScriptSystem::runDebugScript(std::string script) { | |||
235 | newScript.runner.reset(new sol::thread(sol::thread::create(engine_.lua_state()))); | 235 | newScript.runner.reset(new sol::thread(sol::thread::create(engine_.lua_state()))); |
236 | 236 | ||
237 | sol::load_result loaded_script = newScript.runner->state().load(script); | 237 | sol::load_result loaded_script = newScript.runner->state().load(script); |
238 | if (!loaded_script.valid()) { | ||
239 | std::cout << "Error running debug command: " << script << std::endl; | ||
240 | return; | ||
241 | } | ||
242 | |||
238 | newScript.callable.reset(new sol::coroutine(loaded_script)); | 243 | newScript.callable.reset(new sol::coroutine(loaded_script)); |
239 | 244 | ||
240 | if (!*newScript.callable) { | 245 | if (!*newScript.callable) { |