gsdx: avoid a potential division by zero

CID 146835 (#1 of 1): Division or modulo by float zero (DIVIDE_BY_ZERO)
50. divide_by_zero: In expression (float)(end - start) / (float)frame_number, division by expression frame_number which may be zero has undefined behavior
This commit is contained in:
Gregory Hainaut 2015-09-10 17:03:19 +02:00
parent 2934a15902
commit e6d1a4cccf
1 changed files with 2 additions and 0 deletions

View File

@ -1670,6 +1670,8 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
sleep(1);
} else {
unsigned long end = timeGetTime();
frame_number = std::max(1ul, frame_number); // avoid a potential division by 0
fprintf(stderr, "The %ld frames of the scene was render on %ldms\n", frame_number, end - start);
fprintf(stderr, "A means of %fms by frame\n", (float)(end - start)/(float)frame_number);