From c4ed2341ecc29bd7a49e9e369d53dc25fc415030 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 11 Feb 2020 19:01:48 +0100 Subject: Fix potential null pointer dereferences in fluid --- fluid/Fl_Widget_Type.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fluid') diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 655aa7257..ca344170a 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -259,7 +259,8 @@ void Fl_Widget_Type::redraw() { // find the menu button that parents this menu: do t = t->parent; while (t && t->is_menu_item()); // kludge to cause build_menu to be called again: - t->add_child(0,0); + if (t) + t->add_child(0, 0); } else { while (t->parent && t->parent->is_widget()) t = t->parent; ((Fl_Widget_Type*)t)->o->redraw(); @@ -638,6 +639,8 @@ const char *item_name(Fl_Menu_Item* m, int i) { return buffer; } int item_number(Fl_Menu_Item* m, const char* i) { + if (!i) + return 0; if (m && i) { if (i[0]=='F' && i[1]=='L' && i[2]=='_') i += 3; while (m->label()) { -- cgit v1.2.3