Fixed crash when smartshop position unknown
[smartshop.git] / init.lua
index 7db558d..ce6cce0 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -79,6 +79,9 @@ smartshop.receive_fields=function(player,pressed)
                                if pressed["buy" .. i] then break end\r
                        end\r
                        local pos=smartshop.user[player:get_player_name()]\r
+                       if not pos then\r
+                          return\r
+                       end\r
                        local meta=minetest.get_meta(pos)\r
                        local type=meta:get_int("type")\r
                        local inv=meta:get_inventory()\r
@@ -145,6 +148,9 @@ end)
 \r
 \r
 smartshop.update_info=function(pos)\r
+        if not pos then\r
+          return\r
+        end\r
        local meta=minetest.get_meta(pos)\r
        local inv = meta:get_inventory()\r
        local owner=meta:get_string("owner")\r