mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Wrap getLife with pcall to handle error where unit is lost (#3390)
This commit is contained in:
parent
cbf5f5ed90
commit
11304542bd
@ -151,9 +151,11 @@ end
|
||||
function update_hit_points(event)
|
||||
local update = {}
|
||||
update.name = event.target:getName()
|
||||
update.hit_points = event.target:getLife()
|
||||
unit_hit_point_updates[#unit_hit_point_updates + 1] = update
|
||||
write_state()
|
||||
get_life_success, update.hit_points = pcall(event.target.getLife, event.target)
|
||||
if get_life_success then
|
||||
unit_hit_point_updates[#unit_hit_point_updates + 1] = update
|
||||
write_state()
|
||||
end
|
||||
end
|
||||
|
||||
activeWeapons = {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user