mirror of https://github.com/inolen/redream.git
don't attempt to pop the ui history stack if empty
This commit is contained in:
parent
3f2e5ae9f2
commit
5ca08dbb4d
10
src/ui.c
10
src/ui.c
|
@ -1384,9 +1384,9 @@ void ui_set_page(struct ui *ui, int page_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trigger global callbacks for when the ui is open / closed */
|
/* trigger global callbacks for when the ui is open / closed */
|
||||||
if (top_page == NULL && next_page != NULL) {
|
if (!top_page && next_page) {
|
||||||
ui_opened(ui->host);
|
ui_opened(ui->host);
|
||||||
} else if (next_page == NULL) {
|
} else if (!next_page) {
|
||||||
ui_closed(ui->host);
|
ui_closed(ui->host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1432,10 +1432,8 @@ int ui_keydown(struct ui *ui, int key, int16_t value) {
|
||||||
/* prioritize canceling any open dialog */
|
/* prioritize canceling any open dialog */
|
||||||
if (ui->dlg) {
|
if (ui->dlg) {
|
||||||
ui_close_dlg(ui, UI_DLG_CANCEL);
|
ui_close_dlg(ui, UI_DLG_CANCEL);
|
||||||
}
|
} else if (ui->history_pos > 1) {
|
||||||
/* else, pop the history stack */
|
ui->history_pos = ui->history_pos - 1;
|
||||||
else {
|
|
||||||
ui->history_pos = MAX(ui->history_pos - 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue