From 256dbee25597f4da8726063084f94eb821babf14 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 2 May 2021 10:21:27 +0100 Subject: Fix: Crash when extra viewport height is zero with sign in view. (#9175) If a viewport sign straddles the top of a viewport, a crash will occur if the viewport height is zero. This is resolved by simply not attempting to draw the viewport in this situation, consistent with other widgets. --- src/widget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widget.cpp b/src/widget.cpp index 68bc43d78..5c1c0ae8f 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -2029,6 +2029,8 @@ void NWidgetViewport::SetupSmallestSize(Window *w, bool init_array) void NWidgetViewport::Draw(const Window *w) { + if (this->current_x == 0 || this->current_y == 0) return; + if (this->disp_flags & ND_NO_TRANSPARENCY) { TransparencyOptionBits to_backup = _transparency_opt; _transparency_opt &= (1 << TO_SIGNS) | (1 << TO_LOADING); // Disable all transparency, except textual stuff -- cgit v1.2.3-70-g09d2