diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-21 00:06:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-21 00:06:33 +0200 |
commit | d8032dfdd59ee959dc0c43cf5bf5b30f840e16eb (patch) | |
tree | 11f484eb648c17131f4c9a8e70d36fadc7317132 | |
parent | d88d0d457d2828db2016f4854efff8c5f8b90e91 (diff) | |
parent | dd4fe8588bcf0e99b16e45508da7dcc3a1f3bb8e (diff) |
Merge pull request #21239 from Calinou/fix-assetlib-download-crash
Fix occasional crash when downloading assets from the Asset Library
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 4ed2b051aa..66770d98e5 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -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) { |