Tidy up error handling slightly

This commit is contained in:
Katy Coe
2020-06-16 23:08:15 +02:00
parent d16db6f1f5
commit 0f2fff6e70
2 changed files with 13 additions and 7 deletions

View File

@@ -308,9 +308,15 @@ namespace Il2CppInspector
Console.WriteLine("Detected metadata version " + metadata.Version);
// Load the il2cpp code file (try all available file formats)
IFileFormatReader stream = FileFormatReader.Load(codeFile);
if (stream == null) {
Console.Error.WriteLine("Unsupported executable file format");
IFileFormatReader stream;
try {
stream = FileFormatReader.Load(codeFile);
if (stream == null)
throw new InvalidOperationException("Unsupported executable file format");
}
catch (Exception ex) {
Console.Error.WriteLine(ex.Message);
return null;
}