1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

Codefix: check the result of dynamic_cast for nullptr

This commit is contained in:
Rubidium
2025-03-09 18:05:53 +01:00
committed by rubidium42
parent d07d75229b
commit 0de7fd3c24
4 changed files with 6 additions and 1 deletions

View File

@@ -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);