From 3ec58ace778153427a161aca26192ba0279471bf Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Tue, 12 Sep 2017 11:29:35 +0200 Subject: [PATCH] App: be more thorough when checking surface-associated LayoutState Signed-off-by: Marcus Fritzsch --- src/app.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app.cpp b/src/app.cpp index 59b762d..6708706 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -493,7 +493,13 @@ char const *App::deactivate_surface(char const *drawing_name) { return "Cannot deactivate main_surface"; } - struct LayoutState &state = **this->layers.get_layout_state(*surface_id); + auto o_state = *this->layers.get_layout_state(*surface_id); + + if (! o_state) { + return "Could not find layer for surface"; + } + + struct LayoutState &state = *o_state; if (state.main == -1) { return "No surface active"; -- 2.16.6