summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2015-10-14 09:15:35 +0200
committerBlockMen <nmuelll@web.de>2015-10-14 09:15:35 +0200
commit44d40a92aeef3eac5a0996e611ba6d8d39162da6 (patch)
treeafa8760c8a605b5c573726d6866b985986947b3d
parentd5254a20f564e5dfa1f47694b6d2e99ddd5534ef (diff)
Fix unhandled exception
-rw-r--r--api.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/api.lua b/api.lua
index c4a7ba4..42963c6 100644
--- a/api.lua
+++ b/api.lua
@@ -86,6 +86,10 @@ function hud.swap_statbar(player, item1, item2)
local elem1 = hud_id[p_name.."_"..item1]
local elem2 = hud_id[p_name.."_"..item2]
+ if not elem1 or not elem2 or not elem1.id or not elem2.id then
+ return false
+ end
+
player:hud_change(elem2.id, "offset", def1.offset)
player:hud_change(elem1.id, "offset", def2.offset)