summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-11-26 22:46:13 +0000
committerfrosch <frosch@openttd.org>2009-11-26 22:46:13 +0000
commitefffb1b92c872a8cb3adc481a48c58661b83f920 (patch)
treea538b181f574830e7b76d560da908f006ddfd6b4
parent421a24001c5629e29d04c17b0ad3e80d0498856e (diff)
downloadopenttd-efffb1b92c872a8cb3adc481a48c58661b83f920.tar.xz
(svn r18303) -Fix: Widget indices are valid when >= 0.
-rw-r--r--src/widget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 728a95adc..2a43b58ef 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1589,7 +1589,7 @@ NWidgetCore *NWidgetBackground::GetWidgetFromPos(int x, int y)
Scrollbar *NWidgetBackground::FindScrollbar(Window *w, bool allow_next) const
{
- if (this->index > 0 && allow_next && this->child == NULL && (uint)(this->index) + 1 < w->nested_array_size) {
+ if (this->index >= 0 && allow_next && this->child == NULL && (uint)(this->index) + 1 < w->nested_array_size) {
const NWidgetCore *next_wid = w->GetWidget<NWidgetCore>(this->index + 1);
if (next_wid != NULL) return next_wid->FindScrollbar(w, false);
}
@@ -2058,7 +2058,7 @@ Scrollbar *NWidgetLeaf::FindScrollbar(Window *w, bool allow_next) const
if (this->type == WWT_SCROLLBAR) return &w->vscroll;
if (this->type == WWT_SCROLL2BAR) return &w->vscroll2;
- if (this->index > 0 && allow_next && (uint)(this->index) + 1 < w->nested_array_size) {
+ if (this->index >= 0 && allow_next && (uint)(this->index) + 1 < w->nested_array_size) {
const NWidgetCore *next_wid = w->GetWidget<NWidgetCore>(this->index + 1);
if (next_wid != NULL) return next_wid->FindScrollbar(w, false);
}