From 932652397e1e60f026bc111f9148351d4bb37a44 Mon Sep 17 00:00:00 2001 From: mharis001 Date: Tue, 27 Oct 2026 06:24:51 -0400 Subject: [PATCH] Editor Previews - Fix potential zero divisor error --- .../editor_previews/functions/fnc_handleMouseUpdate.sqf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/editor_previews/functions/fnc_handleMouseUpdate.sqf b/addons/editor_previews/functions/fnc_handleMouseUpdate.sqf index 80ef1242c..f971de061 100644 --- a/addons/editor_previews/functions/fnc_handleMouseUpdate.sqf +++ b/addons/editor_previews/functions/fnc_handleMouseUpdate.sqf @@ -22,7 +22,6 @@ params ["_ctrlTree", "_path"]; private _display = ctrlParent _ctrlTree; private _ctrlGroup = _display displayCtrl IDC_PREVIEW_GROUP; - private _type = _ctrlTree tvData _path; if (_type isEqualTo "") then { @@ -35,8 +34,14 @@ if (_type isEqualTo "") then { }; getTextureInfo _image params ["_width", "_height"]; - private _ratio = _width / _height; + // For some reason, getTextureInfo can return zero for the width and height for valid textures + // Usually happens after ALT-TAB-ing out and back into the game on an object type that wasn't previously viewed + if (_width == 0 || {_height == 0}) exitWith { + _ctrlGroup ctrlShow false; + }; + + private _ratio = _width / _height; private _ctrlImage = _display displayCtrl IDC_PREVIEW_IMAGE; _ctrlImage ctrlSetPositionW POS_W(IMAGE_HEIGHT * _ratio); _ctrlImage ctrlSetText _image;