summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/stk.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/stk.c b/src/stk.c
index 9dcbda64..5e5c2e4a 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1093,26 +1093,28 @@ static gboolean handle_command_set_up_menu(const struct stk_command *cmd,
struct stk_response *rsp,
struct ofono_stk *stk)
{
- gboolean modified = FALSE;
+ struct stk_menu *menu = NULL;
- if (stk->main_menu) {
- stk_menu_free(stk->main_menu);
- stk->main_menu = NULL;
+ if (cmd->setup_menu.items) {
+ menu = stk_menu_create_from_set_up_menu(cmd);
- modified = TRUE;
+ if (menu == NULL) {
+ rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+ return TRUE;
+ }
}
- if (cmd->setup_menu.items) {
- stk->main_menu = stk_menu_create_from_set_up_menu(cmd);
+ if (menu == NULL && stk->main_menu == NULL)
+ return TRUE;
- if (stk->main_menu)
- modified = TRUE;
- else
- rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+ if (stk->main_menu) {
+ stk_menu_free(stk->main_menu);
+ stk->main_menu = NULL;
}
- if (modified)
- emit_menu_changed(stk);
+ stk->main_menu = menu;
+
+ emit_menu_changed(stk);
return TRUE;
}