Sfoglia il codice sorgente

Fix divide by zero crash

nordsoft 2 anni fa
parent
commit
d63e32841d
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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;
 }