소스 검색

Fix divide by zero crash

nordsoft 2 년 전
부모
커밋
d63e32841d
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      lib/LoadProgress.cpp

+ 3 - 0
lib/LoadProgress.cpp

@@ -23,6 +23,9 @@ Type Progress::get() const
 	if(_step >= _maxSteps)
 		return _target;
 	
+	if(!_maxSteps)
+		return _progress;
+	
 	return static_cast<int>(_progress) + _step * static_cast<int>(_target - _progress) / _maxSteps;
 }