Fix for AudioEditor allowing empty categories

This commit is contained in:
MattNL
2023-01-10 10:49:08 -05:00
parent b0f44e79b3
commit acca1e3287

View File

@@ -262,8 +262,15 @@ namespace PckStudio.Forms.Editor
}
PCKAudioFile.AudioCategory overworldCategory = audioFile.GetCategory(PCKAudioFile.AudioCategory.EAudioType.Overworld);
foreach (var category in audioFile.Categories)
{
if (category.SongNames.Count < 1)
{
MessageBox.Show("The game will crash upon loading your pack if any of the categories are empty. Please remove or occupy the category.", "Empty Category");
return;
}
category.Name = "";
if (playOverworldInCreative.Checked && category.audioType == PCKAudioFile.AudioCategory.EAudioType.Creative)
{
@@ -279,14 +286,6 @@ namespace PckStudio.Forms.Editor
}
}
bool emptyCat = false;
if (emptyCat)
{
MessageBox.Show("The game will crash upon loading your pack if a category is empty", "Empty Category");
return;
}
using (var stream = new MemoryStream())
{
PCKAudioFileWriter.Write(stream, audioFile, _isLittleEndian);