浏览代码

Update ResourceLoaderText::load to not update progress if resources are 0

Include check in other progress update statement

Update additional progress update statement
[email protected] 5 年之前
父节点
当前提交
94b09da9a1
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      scene/resources/resource_format_text.cpp

+ 3 - 3
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);
 			*progress = resource_current / float(resources_total);
 		}
 		}
 	}
 	}
@@ -640,7 +640,7 @@ Error ResourceLoaderText::load() {
 				return error;
 				return error;
 			} else {
 			} else {
 				error = OK;
 				error = OK;
-				if (progress) {
+				if (progress && resources_total > 0) {
 					*progress = resource_current / float(resources_total);
 					*progress = resource_current / float(resources_total);
 				}
 				}
 
 
@@ -674,7 +674,7 @@ Error ResourceLoaderText::load() {
 
 
 		resource_current++;
 		resource_current++;
 
 
-		if (progress) {
+		if (progress && resources_total > 0) {
 			*progress = resource_current / float(resources_total);
 			*progress = resource_current / float(resources_total);
 		}
 		}