1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-15 16:32:41 +01:00

Codefix: Avoid divide by 0 in div/mod type varaction2 adjusts (#13123)

This commit is contained in:
Jonathan G Rennison
2024-11-27 23:24:46 +00:00
committed by GitHub
parent 23e252ad40
commit f5a6a31e4a

View File

@@ -5254,6 +5254,7 @@ static void NewSpriteGroup(ByteReader &buf)
if (adjust.type != DSGA_TYPE_NONE) {
adjust.add_val = buf.ReadVarSize(varsize);
adjust.divmod_val = buf.ReadVarSize(varsize);
if (adjust.divmod_val == 0) adjust.divmod_val = 1; // Ensure that divide by zero cannot occur
} else {
adjust.add_val = 0;
adjust.divmod_val = 0;