From f9a03c4e63927049c29b9116d7376694bf4002b8 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 2 May 2021 10:21:27 +0100 Subject: [PATCH] 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. (cherry picked from commit 256dbee25597f4da8726063084f94eb821babf14) --- src/widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget.cpp b/src/widget.cpp index 6bc04ae01a..7a5c47166a 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -2090,7 +2090,7 @@ void NWidgetViewport::SetupSmallestSize(Window *w, bool init_array) void NWidgetViewport::Draw(const Window *w) { - if (this->IsOutsideDrawArea()) return; + if (this->current_x == 0 || this->current_y == 0 || this->IsOutsideDrawArea()) return; this->base_flags &= ~WBF_DIRTY; if (this->disp_flags & ND_NO_TRANSPARENCY) {