ReportsBase.cc: Remove possible division by zero

CID 1503709: Division or modulo by float zero

Closes #4415
This commit is contained in:
Ryan Long 2021-05-17 11:35:28 -04:00 committed by Joel Sherrill
parent b1ad7e2f6e
commit ffbf313928

View File

@ -482,9 +482,11 @@ void ReportsBase::WriteSummaryReport(
} }
} }
percentage = (double) notExecuted; if ( totalBytes == 0 ) {
percentage /= (double) totalBytes; percentage = 0;
percentage *= 100.0; } else {
percentage = 100.0 * (double) notExecuted / totalBytes;
}
percentageBranches = (double) ( percentageBranches = (double) (
SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName) + SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName) +