瀏覽代碼

avoid division by zero

Gargaj 11 年之前
父節點
當前提交
8f960f0ed2
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      include/assimp/ProgressHandler.hpp

+ 2 - 2
include/assimp/ProgressHandler.hpp

@@ -97,7 +97,7 @@ public:
 	 *   of the file parsing.
 	 *   of the file parsing.
 	 *   */
 	 *   */
 	virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
 	virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
-		float f = currentStep / (float)numberOfSteps;
+		float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;
 		Update( f * 0.5f );
 		Update( f * 0.5f );
 	};
 	};
 
 
@@ -111,7 +111,7 @@ public:
 	 *   increasing, although not necessarily linearly.
 	 *   increasing, although not necessarily linearly.
 	 *   */
 	 *   */
 	virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
 	virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
-		float f = currentStep / (float)numberOfSteps;
+		float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;
 		Update( f * 0.5f + 0.5f );
 		Update( f * 0.5f + 0.5f );
 	};
 	};