Skip to content

Commit

Permalink
Remove unrequired checks
Browse files Browse the repository at this point in the history
If parentEngine was null, then a crash would of occured before now.
  • Loading branch information
alesliehughes authored and flibitijibibo committed Jan 14, 2023
1 parent 16f86bf commit 3c8e7cc
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions src/FACT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,16 +1419,13 @@ uint32_t FACTSoundBank_Destroy(FACTSoundBank *pSoundBank)
FACTCue_Destroy(pSoundBank->cueList);
}

if (pSoundBank->parentEngine != NULL)
{
/* Remove this SoundBank from the Engine list */
LinkedList_RemoveEntry(
&pSoundBank->parentEngine->sbList,
pSoundBank,
pSoundBank->parentEngine->sbLock,
pSoundBank->parentEngine->pFree
);
}
/* Remove this SoundBank from the Engine list */
LinkedList_RemoveEntry(
&pSoundBank->parentEngine->sbList,
pSoundBank,
pSoundBank->parentEngine->sbLock,
pSoundBank->parentEngine->pFree
);

/* SoundBank Name */
pSoundBank->parentEngine->pFree(pSoundBank->name);
Expand Down Expand Up @@ -1595,16 +1592,13 @@ uint32_t FACTWaveBank_Destroy(FACTWaveBank *pWaveBank)
}
}

if (pWaveBank->parentEngine != NULL)
{
/* Remove this WaveBank from the Engine list */
LinkedList_RemoveEntry(
&pWaveBank->parentEngine->wbList,
pWaveBank,
pWaveBank->parentEngine->wbLock,
pWaveBank->parentEngine->pFree
);
}
/* Remove this WaveBank from the Engine list */
LinkedList_RemoveEntry(
&pWaveBank->parentEngine->wbList,
pWaveBank,
pWaveBank->parentEngine->wbLock,
pWaveBank->parentEngine->pFree
);

/* Free everything, finally. */
pWaveBank->parentEngine->pFree(pWaveBank->name);
Expand Down

0 comments on commit 3c8e7cc

Please sign in to comment.