From 71e62711c6cbdf149a180508254906f06dfd73a8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 17 Apr 2015 22:02:23 -0500 Subject: [PATCH] #731 - stop error if target offscreen --- addons/common/functions/fnc_worldToScreenBounds.sqf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf index 7b88350c6a..afb5817d81 100644 --- a/addons/common/functions/fnc_worldToScreenBounds.sqf +++ b/addons/common/functions/fnc_worldToScreenBounds.sqf @@ -40,12 +40,13 @@ if (true) then { { _ppos = worldToScreen (_object modelToWorld _x); - _pposX = _ppos select 0; - _pposY = _ppos select 1; - if (_pposX < _minX) then {_minX = _pposX}; - if (_pposX > _maxX) then {_maxX = _pposX}; - if (_pposY < _minY) then {_minY = _pposY}; - if (_pposY > _maxY) then {_maxY = _pposY}; + if (count _ppos >= 2) then { + EXPLODE_2_PVT(_ppos,_pposX,_pposY); + if (_pposX < _minX) then {_minX = _pposX}; + if (_pposX > _maxX) then {_maxX = _pposX}; + if (_pposY < _minY) then {_minY = _pposY}; + if (_pposY > _maxY) then {_maxY = _pposY}; + }; //else - what to do if it is offscreen? } forEach _boundsCorners; };