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.
This commit is contained in:
PeterN 2021-05-02 10:21:27 +01:00 committed by GitHub
parent 18fb1c3866
commit 256dbee255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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