Skip to content

Commit 7a63e9b

Browse files
committed
fix crash causes by Document without thumb
1 parent 2fd9f3f commit 7a63e9b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

telebot.nim

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,12 @@ proc parseAudio(n: JsonNode): Audio =
242242

243243
proc parsePhotoSize(n: JsonNode): PhotoSize =
244244
new(result)
245-
result.fileId = n["file_id"].str
246-
result.width = n["width"].num.int
247-
result.height = n["height"].num.int
248-
if not n["file_size"].isNil:
249-
result.fileSize = n["file_size"].num.int
245+
if not n["file_id"].isNil:
246+
result.fileId = n["file_id"].str
247+
result.width = n["width"].num.int
248+
result.height = n["height"].num.int
249+
if not n["file_size"].isNil:
250+
result.fileSize = n["file_size"].num.int
250251

251252
proc parsePhoto(n: JsonNode): seq[PhotoSize] =
252253
result = @[]

0 commit comments

Comments
 (0)