summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-01 16:41:14 +0200
committerWuzzy <almikes@aol.com>2016-08-01 16:41:14 +0200
commit9b4dfb5f10826b67619e8914cb8321f35aa7b497 (patch)
treee4de4ccfffc7648abc57aa1da2cfeb11a8ad5f06
parent97779f65a7712d2ed4ceb91e5934d1cb6f9b5686 (diff)
get_viewed_count returns nil for unknown player
-rw-r--r--init.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 1dd2298..f2a8356 100644
--- a/init.lua
+++ b/init.lua
@@ -135,6 +135,9 @@ end
-- Returns how many entries have been viewed by the player
function doc.get_viewed_count(playername, category_id)
+ if doc.data.players[playername] == nil then
+ return nil
+ end
local count = doc.data.players[playername].stored_data.viewed_count[category_id]
if count == nil then
return 0