Skip to content

Commit 30c892a

Browse files
authored
Fix possible division by zero when using -verbose (#906)
1 parent c9a007c commit 30c892a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

source/cppfront.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ auto main(
7878
auto total = count.cpp1_lines + count.cpp2_lines;
7979
if (total > 0) {
8080
out << " (";
81-
if (count.cpp2_lines / count.cpp1_lines > 25) {
81+
if (count.cpp1_lines == 0) {
82+
out << 100;
83+
}
84+
else if (count.cpp2_lines / count.cpp1_lines > 25) {
8285
out << std::setprecision(3)
8386
<< 100.0 * count.cpp2_lines / total;
8487
}

0 commit comments

Comments
 (0)