diff --git a/PCK-Studio/Classes/IO/PCK/PCKFileReader.cs b/PCK-Studio/Classes/IO/PCK/PCKFileReader.cs index ba10ce98..1e96255c 100644 --- a/PCK-Studio/Classes/IO/PCK/PCKFileReader.cs +++ b/PCK-Studio/Classes/IO/PCK/PCKFileReader.cs @@ -25,6 +25,7 @@ namespace PckStudio.Classes.IO.PCK int pck_type = ReadInt(stream); if (pck_type > 0xf0_00_00) // 03 00 00 00 == true throw new OverflowException(nameof(pck_type)); + else if (pck_type < 3) throw new Exception(pck_type.ToString()); _file = new PCKFile(pck_type); ReadLookUpTable(stream); ReadFileEntries(stream); diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 4e326039..e7a989ad 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -171,8 +171,14 @@ namespace PckStudio "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Debug.WriteLine(ex.Message); } + catch (Exception ex) + { + MessageBox.Show("Failed to open pck\n" + + "If this is an Audio/Music Cues pck, please use the specialized editor while inside of the parent pck.", + "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Debug.WriteLine("Can't open pck file of type: " + pck?.type.ToString()); + } } - if (pck?.type < 3) throw new Exception("Can't open pck file of type: " + pck.type.ToString()); return pck; }