Skip to content

Commit

Permalink
check if metadata and gameorigin arent null before doing material lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
InvoxiPlayGames committed Feb 25, 2024
1 parent 6596117 commit 130490b
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions source/SetlistHooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,27 @@ RndMat *MusicLibraryMatHook(MusicLibrary *thisMusicLibrary, int data, int idx, U
node = NodeSortGetNode(ret, idx);
if (node != NULL)
{
nodeType = node->vtable->getNodeType();
if (nodeType == kNodeSong)
// do a basic null check here, sometimes it can be null
if (node->record->metaData != NULL &&
node->record->metaData->mGameOrigin != NULL)
{
// this shit fucking sucks lol
for (curInfo = 0; curInfo < numGameOrigins; curInfo++)
nodeType = node->vtable->getNodeType();
if (nodeType == kNodeSong)
{
if (strcmp(node->record->metaData->mGameOrigin, originInfo[curInfo].gameOrigin) == 0)
// this shit fucking sucks lol
for (curInfo = 0; curInfo < numGameOrigins; curInfo++)
{
if (materials[originInfo[curInfo].num] != NULL)
if (strcmp(node->record->metaData->mGameOrigin, originInfo[curInfo].gameOrigin) == 0)
{
RB3E_DEBUG("Returning material for game origin '%s'", originInfo[curInfo].gameOrigin);
return materials[originInfo[curInfo].num];
}
else
{
RB3E_DEBUG("Material for game origin '%s' is NULL, creation seemingly failed", originInfo[curInfo].gameOrigin);
if (materials[originInfo[curInfo].num] != NULL)
{
RB3E_DEBUG("Returning material for game origin '%s'", originInfo[curInfo].gameOrigin);
return materials[originInfo[curInfo].num];
}
else
{
RB3E_DEBUG("Material for game origin '%s' is NULL, creation seemingly failed", originInfo[curInfo].gameOrigin);
}
}
}
}
Expand Down

0 comments on commit 130490b

Please sign in to comment.