Fix musicmanager possible null ref

This commit is contained in:
Nahuel Rocchetti 2024-06-24 02:34:05 -03:00
parent b6853eb140
commit 67f5a08031

View file

@ -120,9 +120,10 @@ namespace OpenTS2.Audio
private void LoadMusicCategories(List<ResourceKey> musicTitles)
{
var musicCategoriesBytes = _contentProvider.GetEntry(MusicCategoriesXMLKey).GetBytes();
if (musicCategoriesBytes == null)
var musicCategoriesEntry = _contentProvider.GetEntry(MusicCategoriesXMLKey);
if (musicCategoriesEntry == null)
throw new IOException("Can't find Music Categories XML!");
var musicCategoriesBytes = musicCategoriesEntry.GetBytes();
var xml = new PropertySet(musicCategoriesBytes);
if (xml == null)
throw new IOException("Can't load Music Categories XML!");