mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-02 05:26:47 +00:00
Fixed Index Out of Range Exception when retriving available categories
This commit is contained in:
@@ -17,7 +17,7 @@ namespace PckStudio.Classes.FileTypes
|
||||
public readonly int type = 1;
|
||||
|
||||
public AudioCategory[] Categories => Array.FindAll(_categories, c => c is not null);
|
||||
private AudioCategory[] _categories { get; } = new AudioCategory[8];
|
||||
private AudioCategory[] _categories { get; } = new AudioCategory[9];
|
||||
|
||||
public Dictionary<string, string> Credits { get; } = new Dictionary<string, string>();
|
||||
|
||||
|
||||
@@ -589,24 +589,16 @@ namespace PckStudio
|
||||
break;
|
||||
|
||||
case 8 when file.filepath == "audio.pck":
|
||||
try
|
||||
{
|
||||
if (!TryGetLocFile(out LOCFile locFile))
|
||||
throw new Exception("No .loc File found.");
|
||||
AudioEditor audioEditor = new AudioEditor(file, locFile, LittleEndianCheckBox.Checked);
|
||||
audioEditor.ShowDialog(this);
|
||||
if (audioEditor.saved) TrySetLocFile(locFile);
|
||||
audioEditor.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (!TryGetLocFile(out LOCFile locFile))
|
||||
throw new Exception("No .loc File found.");
|
||||
AudioEditor audioEditor = new AudioEditor(file, locFile, LittleEndianCheckBox.Checked);
|
||||
audioEditor.ShowDialog(this);
|
||||
if (audioEditor.saved) TrySetLocFile(locFile);
|
||||
audioEditor.Dispose();
|
||||
break;
|
||||
|
||||
case 9 when file.filepath == "colours.col":
|
||||
if (file.size == 0)
|
||||
if (file.FileSize == 0)
|
||||
{
|
||||
MessageBox.Show("No Color data found.", "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
|
||||
Reference in New Issue
Block a user