mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Merge pull request #1120 from DizzyEggg/patch-5
Fix UB in event_object_movement.c
This commit is contained in:
commit
04117cdb1c
@ -2340,7 +2340,13 @@ const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId)
|
||||
|
||||
static u16 GetObjectEventFlagIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
return GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup)->flagId;
|
||||
struct ObjectEventTemplate *obj = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
||||
#ifdef UBFIX
|
||||
// BUG: The function may return NULL, and attempting to read from NULL may freeze the game using modern compilers.
|
||||
if (obj == NULL)
|
||||
return 0;
|
||||
#endif // UBFIX
|
||||
return obj->flagId;
|
||||
}
|
||||
|
||||
static u16 GetObjectEventFlagIdByObjectEventId(u8 objectEventId)
|
||||
|
Loading…
Reference in New Issue
Block a user