Check content_length for null before parsing in http HEAD message response

fixes #468
This commit is contained in:
fiaxh 2018-11-29 16:30:20 +01:00
parent 542744ade2
commit 680d28360c
2 changed files with 6 additions and 2 deletions

View file

@ -89,7 +89,9 @@ public class FileProvider : Dino.FileProvider, Object {
if (name == "Content-Length") content_length = val; if (name == "Content-Length") content_length = val;
}); });
file_transfer.mime_type = content_type; file_transfer.mime_type = content_type;
file_transfer.size = int.parse(content_length); if (content_length != null) {
file_transfer.size = int.parse(content_length);
}
} }
} }

View file

@ -91,7 +91,9 @@ public class FileProvider : Dino.FileProvider, Object {
if (name == "Content-Length") content_length = val; if (name == "Content-Length") content_length = val;
}); });
file_transfer.mime_type = content_type; file_transfer.mime_type = content_type;
file_transfer.size = int.parse(content_length); if (content_length != null) {
file_transfer.size = int.parse(content_length);
}
} else { } else {
warning("HTTP HEAD download status code " + head_message.status_code.to_string()); warning("HTTP HEAD download status code " + head_message.status_code.to_string());
} }