Skip to content

Commit

Permalink
null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Deterous authored Dec 19, 2024
1 parent 36e4cdf commit a1bef03
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions MPF.Frontend/Tools/PhysicalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,14 @@ public static bool GetBusEncryptionEnabled(Drive? drive)
var appPkgHeaderDeserializer = new SabreTools.Serialization.Deserializers.AppPkgHeader();
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);

byte[] date = BitConverter.GetBytes(appPkgHeader.VersionDate);
if (BitConverter.IsLittleEndian)
Array.Reverse(date);

pkgInfo = $"app.pkg ID: {appPkgHeader.ContentID}" + Environment.NewLine + $"app.pkg Date: {date[0]:X2}{date[1]:X2}-{date[2]:X2}-{date[3]:X2}";
if (appPkgHeader != null)
{
byte[] date = BitConverter.GetBytes(appPkgHeader.VersionDate);
if (BitConverter.IsLittleEndian)
Array.Reverse(date);

pkgInfo = $"app.pkg ID: {appPkgHeader.ContentID}" + Environment.NewLine + $"app.pkg Date: {date[0]:X2}{date[1]:X2}-{date[2]:X2}-{date[3]:X2}";
}
}

if (pkgInfo == "")
Expand Down Expand Up @@ -635,12 +638,15 @@ public static bool GetBusEncryptionEnabled(Drive? drive)
var appPkgHeaderDeserializer = new SabreTools.Serialization.Deserializers.AppPkgHeader();
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);

byte[] date = BitConverter.GetBytes(appPkgHeader.VersionDate);
if (BitConverter.IsLittleEndian)
Array.Reverse(date);
if (appPkgHeader != null)
{
byte[] date = BitConverter.GetBytes(appPkgHeader.VersionDate);
if (BitConverter.IsLittleEndian)
Array.Reverse(date);

string pkgDate = $"{date[0]:X2}{date[1]:X2}-{date[2]:X2}-{date[3]:X2}";
pkgInfo = $"app_sc.pkg ID: {appPkgHeader.ContentID}" + Environment.NewLine + $"app_sc.pkg Date: {pkgDate}";
string pkgDate = $"{date[0]:X2}{date[1]:X2}-{date[2]:X2}-{date[3]:X2}";
pkgInfo = $"app_sc.pkg ID: {appPkgHeader.ContentID}" + Environment.NewLine + $"app_sc.pkg Date: {pkgDate}";
}
}

if (pkgInfo == "")
Expand Down

0 comments on commit a1bef03

Please sign in to comment.