diff options
author | Alexis Maiquez <games-fun-inc@hotmail.com> | 2017-01-17 18:26:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-17 18:26:00 +0300 |
commit | be481aecafb3ce956989d15fe17674f70fbb5c56 (patch) | |
tree | e636caa51ac197a426393300beb19f662ecfc19a | |
parent | ffb04caca71de0cddf28cd33a4575922900a59ed (diff) |
Fix segmentation fault on image downloading
Some images are bugged in telegram (as in they're detected but you cant download them) so this should fix the crash when trying to download these files.
-rw-r--r-- | queries.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -3301,6 +3301,13 @@ void tgl_do_load_file_location (struct tgl_state *TLS, struct tgl_file_location } void tgl_do_load_photo (struct tgl_state *TLS, struct tgl_photo *photo, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success, const char *filename), void *callback_extra) { + if(photo == NULL) { + tgl_set_query_error (TLS, EINVAL, "Bad photo (cannot download"); + if (callback) { + callback (TLS, callback_extra, 0, 0); + } + return; + } if (!photo->sizes_num) { tgl_set_query_error (TLS, EINVAL, "Bad photo (no photo sizes"); if (callback) { |