Skip to content
Snippets Groups Projects
Commit 97d13513 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Avoid potential for divide-by-zero error if called with total=0

Caught by Coverity.
parent 08f3f5c9
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -1404,7 +1404,7 @@ void sbbs_t::progress(const char* text, int count, int total, int interval)
if((count%interval) != 0)
return;
if(text == NULL) text = "";
float pct = ((float)count/total)*100.0F;
float pct = total ? ((float)count/total)*100.0F : 100.0F;
SAFEPRINTF2(str, "[ %-8s %4.1f%% ]", text, pct);
cursor_left(backfill(str, pct, cfg.color[clr_progress_full], cfg.color[clr_progress_empty]));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment