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,9 +89,11 @@ public class FileProvider : Dino.FileProvider, Object {
if (name == "Content-Length") content_length = val;
});
file_transfer.mime_type = content_type;
if (content_length != null) {
file_transfer.size = int.parse(content_length);
}
}
}
public async void download(FileTransfer file_transfer, File file_) {
try {

View file

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