Changeset - r25358:42592b0d6320
[Not reviewed]
master
0 1 0
PeterN - 3 years ago 2021-05-02 09:21:27
peter1138@openttd.org
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.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -2029,6 +2029,8 @@ void NWidgetViewport::SetupSmallestSize(
 

	
 
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
0 comments (0 inline, 0 general)