From 521ef3688069f5fc6b06a835454404fddaca6e80 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 12 Jun 2022 18:23:10 +0200 Subject: fix: add statusline length check --- src/engine/engine.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/engine') 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 + #include +#include #include #include @@ -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]() -- cgit v1.2.3-18-g5258