Fix a formspec crash triggered by ae9b5e00989756bb676429530dfe81039009001c

This commit is contained in:
Loic Blot 2017-08-20 20:24:26 +02:00
parent 226acaeb9e
commit a3441638c6
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987

@ -2844,7 +2844,7 @@ void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
IGUIElement * element = getElementFromId(s.fid); IGUIElement * element = getElementFromId(s.fid);
gui::IGUIComboBox *e = NULL; gui::IGUIComboBox *e = NULL;
if ((element) && (element->getType() == gui::EGUIET_COMBO_BOX)) { if ((element) && (element->getType() == gui::EGUIET_COMBO_BOX)) {
e = dynamic_cast<gui::IGUIComboBox*>(element); e = static_cast<gui::IGUIComboBox*>(element);
} }
s32 selected = e->getSelected(); s32 selected = e->getSelected();
if (selected >= 0) { if (selected >= 0) {
@ -2857,11 +2857,11 @@ void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
} }
else if (s.ftype == f_TabHeader) { else if (s.ftype == f_TabHeader) {
// no dynamic cast possible due to some distributions shipped // no dynamic cast possible due to some distributions shipped
// without rtti support in irrlicht // without rttzi support in irrlicht
IGUIElement * element = getElementFromId(s.fid); IGUIElement * element = getElementFromId(s.fid);
gui::IGUITabControl *e = NULL; gui::IGUITabControl *e = NULL;
if ((element) && (element->getType() == gui::EGUIET_TAB_CONTROL)) { if ((element) && (element->getType() == gui::EGUIET_TAB_CONTROL)) {
e = dynamic_cast<gui::IGUITabControl*>(element); e = static_cast<gui::IGUITabControl *>(element);
} }
if (e != 0) { if (e != 0) {
@ -2876,7 +2876,7 @@ void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
IGUIElement * element = getElementFromId(s.fid); IGUIElement * element = getElementFromId(s.fid);
gui::IGUICheckBox *e = NULL; gui::IGUICheckBox *e = NULL;
if ((element) && (element->getType() == gui::EGUIET_CHECK_BOX)) { if ((element) && (element->getType() == gui::EGUIET_CHECK_BOX)) {
e = dynamic_cast<gui::IGUICheckBox*>(element); e = static_cast<gui::IGUICheckBox*>(element);
} }
if (e != 0) { if (e != 0) {
@ -2892,7 +2892,7 @@ void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
IGUIElement * element = getElementFromId(s.fid); IGUIElement * element = getElementFromId(s.fid);
gui::IGUIScrollBar *e = NULL; gui::IGUIScrollBar *e = NULL;
if ((element) && (element->getType() == gui::EGUIET_SCROLL_BAR)) { if ((element) && (element->getType() == gui::EGUIET_SCROLL_BAR)) {
e = dynamic_cast<gui::IGUIScrollBar*>(element); e = static_cast<gui::IGUIScrollBar*>(element);
} }
if (e != 0) { if (e != 0) {