From 075d1048ab8807ce5bd40fb3448e0ff0c8788b7d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 30 Jul 2018 10:32:38 +0100 Subject: [PATCH] Avoid invalid access to Optional If the UI is not ok, the exit status of the client might not be available. Return -1 in that case. --- src/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cc b/src/main.cc index 1acfdd34..027a32f8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -563,7 +563,7 @@ int run_client(StringView session, StringView name, StringView client_init, raise(SIGTSTP); while (not client.exit_status() and client.is_ui_ok()) event_manager.handle_next_events(EventMode::Normal); - return *client.exit_status(); + return client.exit_status().value_or(-1); } catch (disconnected& e) {