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

@@ -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 */