From 4e47630eec9cda41d5ba32993f13881314cfbec3 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 5 Mar 2020 11:25:45 +0100 Subject: [PATCH] Protection --- radio/src/thirdparty/libopenui/src/form.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/form.cpp b/radio/src/thirdparty/libopenui/src/form.cpp index f4063f317..592598e5d 100644 --- a/radio/src/thirdparty/libopenui/src/form.cpp +++ b/radio/src/thirdparty/libopenui/src/form.cpp @@ -154,16 +154,19 @@ void FormGroup::onEvent(event_t event) TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormGroup").c_str(), event); if (event == EVT_KEY_BREAK(KEY_ENTER)) { - first->setFocus(SET_FOCUS_FIRST); + if (first) + first->setFocus(SET_FOCUS_FIRST); } else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus() && !(windowFlags & FORM_FORWARD_FOCUS)) { setFocus(SET_FOCUS_DEFAULT); } else if (event == EVT_ROTARY_RIGHT && !next) { - first->setFocus(SET_FOCUS_FIRST); + if (first) + first->setFocus(SET_FOCUS_FIRST); } else if (event == EVT_ROTARY_LEFT && !previous) { - last->setFocus(SET_FOCUS_FIRST); + if (last) + last->setFocus(SET_FOCUS_FIRST); } else { FormField::onEvent(event);