Fixes runtimes in fit_viewport when user has the game minimized (#89802)

## About The Pull Request

Winget returns 0x0 size when the window is minimized, and it can be set
to 0x0 via external tools as well. In this case we should just abort
fit_viewport to prevent runtimes.

## Changelog

Not player facing
This commit is contained in:
SmArtKar
2025-03-06 16:31:35 +01:00
committed by Roxy
parent ab7e998b08
commit e1c7103bab
+7 -3
View File
@@ -364,6 +364,13 @@ ADMIN_VERB(reset_ooc_color, R_FUN, "Reset Player OOC Color", "Returns player OOC
var/list/map_size = splittext(sizes["mapwindow.size"], "x")
var/split_size = splittext(sizes["mainwindow.split.size"], "x")
var/split_width = text2num(split_size[1])
// Window is minimized, we can't get proper data so return to avoid division by 0
if (!split_width)
return
// Gets the type of zoom we're currently using from our view datum
// If it's 0 we do our pixel calculations based off the size of the mapwindow
// If it's not, we already know how big we want our window to be, since zoom is the exact pixel ratio of the map
@@ -385,9 +392,6 @@ ADMIN_VERB(reset_ooc_color, R_FUN, "Reset Player OOC Color", "Returns player OOC
// Nothing to do
return
var/split_size = splittext(sizes["mainwindow.split.size"], "x")
var/split_width = text2num(split_size[1])
// Avoid auto-resizing the statpanel and chat into nothing.
desired_width = min(desired_width, split_width - 300)