From 9b4dfb5f10826b67619e8914cb8321f35aa7b497 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 1 Aug 2016 16:41:14 +0200 Subject: get_viewed_count returns nil for unknown player --- init.lua | 3 +++ 1 file changed, 3 insertions(+) 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 -- cgit v1.2.3