summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-08-16 22:37:27 +0200
committerGitHub <noreply@github.com>2020-08-16 22:37:27 +0200
commita17fba3f21241beb68127d30b8d07db267e65e35 (patch)
treebbeac1a3aea1c4ab4d06e17e5fb35161f8d92b66
parent75e2a405d008d6ee6455079ba37b6a6202c5f932 (diff)
parent94b09da9a137a755a80554f13ef7cbee7ac032b8 (diff)
Merge pull request #41302 from Jlalond/divide-by-zero
Update ResourceLoaderText::load to not update progress if resources a…
-rw-r--r--scene/resources/resource_format_text.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 93db8b725f..d4d8018d43 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -572,7 +572,7 @@ Error ResourceLoaderText::load() {
}
}
- if (progress) {
+ if (progress && resources_total > 0) {
*progress = resource_current / float(resources_total);
}
}
@@ -640,7 +640,7 @@ Error ResourceLoaderText::load() {
return error;
} else {
error = OK;
- if (progress) {
+ if (progress && resources_total > 0) {
*progress = resource_current / float(resources_total);
}
@@ -674,7 +674,7 @@ Error ResourceLoaderText::load() {
resource_current++;
- if (progress) {
+ if (progress && resources_total > 0) {
*progress = resource_current / float(resources_total);
}