mirror of https://github.com/OpenTTD/OpenTTD
Codefix: check the result of dynamic_cast for nullptr
parent
d07d75229b
commit
0de7fd3c24
|
@ -1156,6 +1156,7 @@ void ShowQuery(EncodedString &&caption, EncodedString &&message, Window *parent,
|
|||
if (w->window_class != WC_CONFIRM_POPUP_QUERY) continue;
|
||||
|
||||
QueryWindow *qw = dynamic_cast<QueryWindow *>(w);
|
||||
assert(qw != nullptr);
|
||||
if (qw->parent != parent || qw->proc != callback) continue;
|
||||
|
||||
qw->Close();
|
||||
|
|
|
@ -1925,6 +1925,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
|||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
CloseWindowByClass(WC_TEXTFILE);
|
||||
NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w);
|
||||
assert(nw != nullptr);
|
||||
|
||||
_gamelog.StartAction(GLAT_GRF);
|
||||
_gamelog.GRFUpdate(_grfconfig, nw->actives); // log GRF changes
|
||||
|
|
|
@ -1441,7 +1441,9 @@ public:
|
|||
NWidgetBase *nwid = it->get();
|
||||
nwid->current_x = 0; /* Hide widget, it will be revealed in the next step. */
|
||||
if (nwid->type == NWID_SPACER) continue;
|
||||
lookup[dynamic_cast<NWidgetCore *>(nwid)->GetIndex()] = std::distance(this->children.begin(), it);
|
||||
NWidgetCore *nwc = dynamic_cast<NWidgetCore *>(nwid);
|
||||
assert(nwc != nullptr);
|
||||
lookup[nwc->GetIndex()] = std::distance(this->children.begin(), it);
|
||||
}
|
||||
|
||||
/* Now assign the widgets to their rightful place */
|
||||
|
|
|
@ -530,6 +530,7 @@ void Window::RaiseButtons(bool autoraise)
|
|||
for (auto &pair : this->widget_lookup) {
|
||||
WidgetType type = pair.second->type;
|
||||
NWidgetCore *wid = dynamic_cast<NWidgetCore *>(pair.second);
|
||||
assert(wid != nullptr);
|
||||
if (((type & ~WWB_PUSHBUTTON) < WWT_LAST || type == NWID_PUSHBUTTON_DROPDOWN) &&
|
||||
(!autoraise || (type & WWB_PUSHBUTTON) || type == WWT_EDITBOX) && wid->IsLowered()) {
|
||||
wid->SetLowered(false);
|
||||
|
|
Loading…
Reference in New Issue