Skip to content

Commit

Permalink
Fix GraphQL user crash with invalid JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
zedeus committed Jul 1, 2023
1 parent 38985af commit dcf7335
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/experimental/parser/graphql.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import user, ../types/[graphuser, graphlistmembers]
from ../../types import User, Result, Query, QueryKind

proc parseGraphUser*(json: string): User =
if json.len == 0 or json[0] != '{':
return

let raw = json.fromJson(GraphUser)

if raw.data.user.result.reason.get("") == "Suspended":
Expand Down

0 comments on commit dcf7335

Please sign in to comment.