Prevent crash when token missing

This commit is contained in:
Zed 2020-06-01 13:54:14 +02:00
parent 87d1e49f1a
commit baa28ea8bc
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@ proc fetchToken(): Future[Token] {.async.} =
try: client.close()
except: discard
if pos == -1: echo "token parse fail"; return
if pos == -1:
echo "token parse fail"
return Token()
result = Token(tok: resp[pos+3 .. pos+21], remaining: 187,
reset: getTime() + 15.minutes, init: getTime())