summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-12 09:10:53 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-12 09:10:53 +0300
commit49bdcc535b1f686abcd110bd5daa64e7d6286bbc (patch)
treec8c40f8528e0a894e7f83c62e1c9465b93c1be9e /src/ui
parent85c77f3eed5e00a692fb33740fe52bb95f5eb499 (diff)
App: Mitigations against a possible crash
A tab switch may have ended up accessing a NULL pointer.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 754545bd..6fa3e293 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -768,7 +768,7 @@ iLabelWidget *makeMenuButton_LabelWidget(const char *label, const iMenuItem *ite
768/*-----------------------------------------------------------------------------------------------*/ 768/*-----------------------------------------------------------------------------------------------*/
769 769
770static iBool isTabPage_Widget_(const iWidget *tabs, const iWidget *page) { 770static iBool isTabPage_Widget_(const iWidget *tabs, const iWidget *page) {
771 return page->parent == findChild_Widget(tabs, "tabs.pages"); 771 return page && page->parent == findChild_Widget(tabs, "tabs.pages");
772} 772}
773 773
774static iBool tabSwitcher_(iWidget *tabs, const char *cmd) { 774static iBool tabSwitcher_(iWidget *tabs, const char *cmd) {
@@ -787,7 +787,7 @@ static iBool tabSwitcher_(iWidget *tabs, const char *cmd) {
787 } 787 }
788 else if (hasParent_Widget(target, tabs)) { 788 else if (hasParent_Widget(target, tabs)) {
789 /* Some widget on a page. */ 789 /* Some widget on a page. */
790 while (!isTabPage_Widget_(tabs, target)) { 790 while (target && !isTabPage_Widget_(tabs, target)) {
791 target = target->parent; 791 target = target->parent;
792 } 792 }
793 showTabPage_Widget(tabs, target); 793 showTabPage_Widget(tabs, target);