Skip to content

Commit

Permalink
cmd_share_unit: Don't crash when hovering over a unit in front of sky. (
Browse files Browse the repository at this point in the history
  • Loading branch information
saurtron authored Dec 26, 2024
1 parent c105923 commit 03b6a18
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions luaui/Widgets/cmd_share_unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ local function getMouseTargetPosition()
return mouseTarget[1], mouseTarget[2], mouseTarget[3]
elseif mouseTargetType == "unit" then
local _, coordinates = TraceScreenRay(mx, my, true)
return coordinates[1], coordinates[2], coordinates[3], mouseTarget
if coordinates then
return coordinates[1], coordinates[2], coordinates[3], mouseTarget
else
return nil, nil, nil, mouseTarget
end
elseif mouseTargetType == "feature" then
local _, coordinates = TraceScreenRay(mx, my, true)
if coordinates then
Expand Down Expand Up @@ -285,7 +289,7 @@ local function getSelectedTeam()

local tx, ty, tz, targetUnitID = getMouseTargetPosition()

if (not tx) then
if (not tx and not targetUnitID) then
return nil
end

Expand Down

0 comments on commit 03b6a18

Please sign in to comment.