소스 검색

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.
 	 *   */
 	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 );
 	};
 
@@ -111,7 +111,7 @@ public:
 	 *   increasing, although not necessarily linearly.
 	 *   */
 	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 );
 	};