Fixed crash in DynOS_Actor_AddCustom()

This commit is contained in:
MysterD 2023-11-08 12:22:24 -08:00
parent 3585e20eee
commit 301448f78a
1 changed files with 6 additions and 2 deletions

View File

@ -25,12 +25,16 @@ static Array<Pair<const char*, void *>>& DynosCustomActors() {
void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) { void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) {
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
u16 actorLen = strlen(aActorName); u16 actorLen = strlen(aActorName);
char* actorName = (char*)calloc(1, sizeof(char) * (actorLen + 1)); char* actorName = (char*)calloc(1, sizeof(char) * (actorLen + 1));
strcpy(actorName, aActorName); strcpy(actorName, aActorName);
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
if (!georef) {
PrintError(" ERROR: Couldn't find georef for \"%s\"", actorName);
free(actorName);
}
GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename, false); GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename, false);
if (!_GfxData) { if (!_GfxData) {
PrintError(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName, aFilename.c_str()); PrintError(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName, aFilename.c_str());