port UBFIXes from emerald

This commit is contained in:
Kurausukun
2021-06-26 04:04:22 -04:00
parent 8116790c08
commit 88bd618496
8 changed files with 65 additions and 7 deletions
+7 -1
View File
@@ -2561,7 +2561,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)