summaryrefslogtreecommitdiff
path: root/src/battle_script_commands.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-07-01 14:26:34 -0400
committerGitHub <noreply@github.com>2021-07-01 14:26:34 -0400
commit3964820a84e4819bb807d601d2c3c7b196f764e8 (patch)
tree3fdb4dba5c6016010d0f00555897dcbdd116ca32 /src/battle_script_commands.c
parent63b93c46116311d0d3d95119ba814b434dd9bd3c (diff)
parent93188ef0a8aac4855903543c3b059285baccebc2 (diff)
Merge pull request #1473 from GriffinRichards/fix-div0
Fix divide by 0 in Cmd_getexp
Diffstat (limited to 'src/battle_script_commands.c')
-rw-r--r--src/battle_script_commands.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 15e44dd75..d927ffb76 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -3269,7 +3269,7 @@ static void Cmd_getexp(void)
if (viaExpShare) // at least one mon is getting exp via exp share
{
- *exp = calculatedExp / 2 / viaSentIn;
+ *exp = SAFE_DIV(calculatedExp / 2, viaSentIn);
if (*exp == 0)
*exp = 1;
@@ -3279,7 +3279,7 @@ static void Cmd_getexp(void)
}
else
{
- *exp = calculatedExp / viaSentIn;
+ *exp = SAFE_DIV(calculatedExp, viaSentIn);
if (*exp == 0)
*exp = 1;
gExpShareExp = 0;