Fix division by zero segfault (#28)

Bug was introduced in c9378cfaba

Thanks to Eblog for reporting the bug.
This commit is contained in:
Splendide Imaginarius 2023-10-09 02:32:38 +00:00 committed by GitHub
parent fae7fa9c4e
commit f46e132945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -728,6 +728,13 @@ struct InputPrivate
} dir8Data;
void recalcRepeatTime(unsigned int fps) {
// 0 fps would cause a divide by zero segfault later.
// Bail in that case.
if (fps == 0)
{
return;
}
double framems = 1.f / fps;
// Approximate time in milliseconds