Skip to content

Commit

Permalink
Handle empty livery file
Browse files Browse the repository at this point in the history
  • Loading branch information
nic547 committed Aug 30, 2020
1 parent 5527eb6 commit a4f5dda
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MainWindow.xaml.cs
Expand Up @@ -231,6 +231,14 @@ private string LoadGameLiveries()
byte[] LiveryFile = File.ReadAllBytes(Cfg["GamePath"]);

int HeaderEnd = LocateInByteArray(LiveryFile, SOL);
if (HeaderEnd < 0)

{
Log.AddLogMessage("No livery found - at least one livery needs to already exist.", "MW::LoadGameLiveries", Log.LogLevel.ERROR);
((Data)DataContext).Useable = false;
return "Empty livery file - please ensure you've created at least one livery.";
}

byte[] Header = new byte[HeaderEnd];
Array.Copy(LiveryFile, Header, Header.Length);
SplitFile.Add(0, Header);
Expand Down

0 comments on commit a4f5dda

Please sign in to comment.