Skip to content

Commit

Permalink
Fix never happen error
Browse files Browse the repository at this point in the history
  • Loading branch information
Lejo1 committed Aug 18, 2019
1 parent 8dd3edd commit c46b138
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ local current = {}
local storage = minetest.get_mod_storage()

function playtime.get_current_playtime(name)
return os.time() - current[name]
if current[name] then
return os.time() - current[name]
else return 0
end
end

-- Function to get playtime
Expand Down

0 comments on commit c46b138

Please sign in to comment.