Skip to content

Commit

Permalink
fixed potential undefined behaviour when using escape rope (#4705)
Browse files Browse the repository at this point in the history
  • Loading branch information
cawtds authored Jun 2, 2024
1 parent 658b437 commit 7404d03
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/item_use.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,14 +1041,10 @@ static void ItemUseOnFieldCB_EscapeRope(u8 taskId)
{
Overworld_ResetStateAfterDigEscRope();
if (I_KEY_ESCAPE_ROPE < GEN_8)
{
RemoveUsedItem();
}
else
{
CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2);
}
RemoveBagItem(gSpecialVar_ItemId, 1);

CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2);
gTasks[taskId].data[0] = 0;
DisplayItemMessageOnField(taskId, gStringVar4, Task_UseDigEscapeRopeOnField);
}
Expand Down

0 comments on commit 7404d03

Please sign in to comment.