summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 320a34e80..f4a64f412 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1693,7 +1693,8 @@ Dimension NWidgetLeaf::closebox_dimension = {0, 0};
*/
NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint16 data, StringID tip) : NWidgetCore(tp, colour, 1, 1, data, tip)
{
- this->SetIndex(index);
+ assert(index >= 0 || tp == WWT_LABEL || tp == WWT_TEXT);
+ if (index >= 0) this->SetIndex(index);
this->SetMinimalSize(0, 0);
this->SetResize(0, 0);