Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Maiquez <games-fun-inc@hotmail.com>2017-01-17 18:26:00 +0300
committerGitHub <noreply@github.com>2017-01-17 18:26:00 +0300
commitbe481aecafb3ce956989d15fe17674f70fbb5c56 (patch)
treee636caa51ac197a426393300beb19f662ecfc19a
parentffb04caca71de0cddf28cd33a4575922900a59ed (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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/queries.c b/queries.c
index 5c1c528..8ea9340 100644
--- a/queries.c
+++ b/queries.c
@@ -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) {