mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
2934a15902
commit
e6d1a4cccf
|
@ -1670,6 +1670,8 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} else {
|
} else {
|
||||||
unsigned long end = timeGetTime();
|
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, "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);
|
fprintf(stderr, "A means of %fms by frame\n", (float)(end - start)/(float)frame_number);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue