diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-12 18:23:10 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:02 +0200 |
commit | 521ef3688069f5fc6b06a835454404fddaca6e80 (patch) | |
tree | dda147c27d8932697a12f02a78232382026659b9 /src/engine | |
parent | 7399afb9ec9776dfa131dbf27ed6fb7524aec81b (diff) |
fix: add statusline length check
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/engine.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index ed75394..b0456a3 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -2,7 +2,10 @@ #include "util/function.hpp" +#include <fmt/core.h> + #include <chrono> +#include <exception> #include <thread> #include <utility> @@ -30,7 +33,16 @@ void CLIGameEngine::start() noexcept auto game = _game_factory(_scene, _cursor_controller, _user_input_observer); - game->on_start(); + try + { + game->on_start(); + } + catch (const std::exception &error) + { + _scene->leave(); + fmt::print("Error: {}\n", error.what()); + return; + } std::atexit(normalize_lambda( [this, &game]() |