Merge pull request #1979 from DizzyEggg/patch-2

Change Safe Div to explicitly check b != 0
This commit is contained in:
GriffinR authored and GitHub committed 2024-02-04 20:22:37 -05:00
commit 246f47d9d0
1 file changed
+1 -1
+1 -1
View File
@@ -80,7 +80,7 @@
// Used in cases where division by 0 can occur in the retail version.
// Avoids invalid opcodes on some emulators, and the otherwise UB.
#ifdef UBFIX
#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0)
#define SAFE_DIV(a, b) (((b) != 0) ? (a) / (b) : 0)
#else
#define SAFE_DIV(a, b) ((a) / (b))
#endif