Potential Division by Zero

This commit is contained in:
2025-12-09 22:02:59 +01:00
parent c27471ae03
commit acc05dac8b
2 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,7 @@
*/
#include "../include/reHDD.h"
using namespace std;
bool Printer::instanceFlag = false;
Printer *Printer::single = NULL;

View File

@ -224,6 +224,8 @@ double Shred::calcProgress()
#ifdef ZERO_CHECK
uiMaxShredIteration++; // increment because we will check after SHRED_ITERATIONS the drive for non-zero bytes
#endif
if (this->ulDriveByteSize == 0)
return 0.0;
return (double)(((double)ulDriveByteOverallCount) / ((double)this->ulDriveByteSize * uiMaxShredIteration)) * 100.0f;
}