avoid divide-by-0 in stats

This commit is contained in:
Mitchell Livingston
2007-11-26 19:18:00 +00:00
parent 6b5f1839aa
commit bf3bd6bd5d
2 changed files with 7 additions and 4 deletions

View File

@@ -88,8 +88,11 @@ tr_handle * fLib;
stringByAppendingString: NSLocalizedString(@" total", "stats total")]];
[fRatioField setStringValue: [NSString stringForRatio: statsSession.ratio]];
[fRatioAllField setStringValue: [[NSString stringForRatio: statsAll.ratio]
stringByAppendingString: NSLocalizedString(@" total", "stats total")]];
NSString * totalRatioString = statsAll.ratio != TR_RATIO_NA
? [[NSString stringForRatio: statsAll.ratio] stringByAppendingString: NSLocalizedString(@" total", "stats total")]
: NSLocalizedString(@"Total N/A", "stats total");
[fRatioAllField setStringValue: totalRatioString];
[fTimeField setStringValue: [self timeString: statsSession.secondsActive]];
[fTimeAllField setStringValue: [[self timeString: statsAll.secondsActive]