From fdf231ddfa2c83ebe2af6b79f5310ca8e2f5a4e1 Mon Sep 17 00:00:00 2001 From: Robert Borzecki Date: Mon, 8 Jul 2019 10:03:41 +0200 Subject: [PATCH] Fixed crash where there is no focus widget in window. --- env.cmake | 2 +- module-gui/gui/widgets/Window.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/env.cmake b/env.cmake index 8aa5198c3..bc50a8fdc 100644 --- a/env.cmake +++ b/env.cmake @@ -1 +1 @@ -set(TOOLCHAIN_PATH "/usr" CACHE INTERNAL "") +set(TOOLCHAIN_PATH "/home/robert/toolchain/gcc-arm-none-eabi-8-2018-q4-major" CACHE INTERNAL "") diff --git a/module-gui/gui/widgets/Window.cpp b/module-gui/gui/widgets/Window.cpp index 23486edb8..edf02ac3a 100644 --- a/module-gui/gui/widgets/Window.cpp +++ b/module-gui/gui/widgets/Window.cpp @@ -88,7 +88,7 @@ bool Window::onInput( const InputEvent& inputEvent) { //if focused item didn't handle the key event and it was navigation key //check if moving focus is possible gui::Item* newFocusItem = nullptr; - if( !res && inputEvent.state == InputEvent::State::keyReleasedShort ) { + if( (!res) && (focusItem != nullptr ) && (inputEvent.state == InputEvent::State::keyReleasedShort) ) { switch( inputEvent.keyCode ) { case KeyCode::KEY_LEFT: newFocusItem = focusItem->getNavigationItem(gui::NavigationDirection::LEFT);