diff --git a/src/stats.cpp b/src/stats.cpp index deca75c..986069b 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -850,7 +850,14 @@ void Stats::reportHtmlContents(ofstream& ofs, string filteringType, string readN } else { count = mBaseContents['G' & 0x07] + mBaseContents['C' & 0x07] ; } - string percentage = to_string((double)count * 100.0 / mBases); + + string percentage; + if (mBases != 0) { + percentage = to_string((double)count * 100.0 / mBases); + } else { + percentage = "-nan"; + } + if(percentage.length()>5) percentage = percentage.substr(0,5); string name = base + "(" + percentage + "%)";