Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segmentation fault on image downloading #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Almamu authored Jan 17, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit be481aecafb3ce956989d15fe17674f70fbb5c56
7 changes: 7 additions & 0 deletions queries.c
Original file line number Diff line number Diff line change
@@ -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) {