summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auth.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/auth.lua b/auth.lua
index 978fbc4..2a97ab4 100644
--- a/auth.lua
+++ b/auth.lua
@@ -142,8 +142,9 @@ function M.user(uid)
end
function M:get_data()
- assert(
- type(self.uid) == 'string' and self.uid:match '^%w+$', "invalid uid")
+ if type(self.uid) ~= 'string' or not self.uid:match '^%w+$' then
+ return nil
+ end
local cached, data = cache_get('users', self.uid)
if cached then return data end
data = api_get('/api/user/'..self.uid)