Merge pull request #21239 from Calinou/fix-assetlib-download-crash

Fix occasional crash when downloading assets from the Asset Library
This commit is contained in:
Rémi Verschelde 2018-08-21 00:06:33 +02:00 committed by GitHub
commit d8032dfdd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -421,7 +421,16 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
int cstatus = download->get_http_client_status();
if (cstatus == HTTPClient::STATUS_BODY) {
status->set_text(vformat(TTR("Downloading (%s / %s)..."), String::humanize_size(download->get_downloaded_bytes()), String::humanize_size(download->get_body_size())));
if (download->get_body_size() > 0) {
status->set_text(
vformat(
TTR("Downloading (%s / %s)..."),
String::humanize_size(download->get_downloaded_bytes()),
String::humanize_size(download->get_body_size())));
} else {
// Total file size is unknown, so it cannot be displayed
status->set_text(TTR("Downloading..."));
}
}
if (cstatus != prev_status) {