mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-04 13:23:46 +00:00
(svn r18593) -Fix: GetWidget call case similar to r18591
This commit is contained in:
parent
38ceeb41b7
commit
50734030aa
@ -2090,7 +2090,11 @@ Scrollbar *NWidgetLeaf::FindScrollbar(Window *w, bool allow_next) const
|
||||
if (this->type == WWT_SCROLL2BAR) return &w->vscroll2;
|
||||
|
||||
if (this->index >= 0 && allow_next && (uint)(this->index) + 1 < w->nested_array_size) {
|
||||
const NWidgetCore *next_wid = w->GetWidget<NWidgetCore>(this->index + 1);
|
||||
/* GetWidget ensures that the widget is of the given type.
|
||||
* As we might have cases where the next widget in the array
|
||||
* is a non-Core widget (e.g. NWID_SELECTION) we first get
|
||||
* the base class and then dynamic_cast that. */
|
||||
const NWidgetCore *next_wid = dynamic_cast<NWidgetCore*>(w->GetWidget<NWidgetBase>(this->index + 1));
|
||||
if (next_wid != NULL) return next_wid->FindScrollbar(w, false);
|
||||
}
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user