1
0
mirror of https://github.com/zedeus/nitter synced 2024-11-22 01:45:22 +01:00

Fix GraphQL user crash with invalid JSON

This commit is contained in:
Zed 2023-07-01 22:07:37 +02:00
parent 38985af6ed
commit dcf73354ff

View File

@ -4,6 +4,9 @@ import user, ../types/[graphuser, graphlistmembers]
from ../../types import User, Result, Query, QueryKind from ../../types import User, Result, Query, QueryKind
proc parseGraphUser*(json: string): User = proc parseGraphUser*(json: string): User =
if json.len == 0 or json[0] != '{':
return
let raw = json.fromJson(GraphUser) let raw = json.fromJson(GraphUser)
if raw.data.user.result.reason.get("") == "Suspended": if raw.data.user.result.reason.get("") == "Suspended":