diff --git a/SabreTools.Helper/Tools/DatTools.cs b/SabreTools.Helper/Tools/DatTools.cs index 867de9f2..64dfed87 100644 --- a/SabreTools.Helper/Tools/DatTools.cs +++ b/SabreTools.Helper/Tools/DatTools.cs @@ -2784,6 +2784,14 @@ namespace SabreTools.Helper for (int index = 0; index < roms.Count; index++) { Rom rom = roms[index]; + + // There are apparently times when a null rom can skip by, skip them + if (rom.Name == null || rom.Machine.Name == null) + { + logger.Warning("Null rom found!"); + continue; + } + List newsplit = rom.Machine.Name.Split('\\').ToList(); // If we have a different game and we're not at the start of the list, output the end of last item @@ -2969,6 +2977,7 @@ namespace SabreTools.Helper // Write the header out sw.Write(header); + sw.Flush(); } catch (Exception ex) { @@ -3040,6 +3049,7 @@ namespace SabreTools.Helper } sw.Write(state); + sw.Flush(); } catch (Exception ex) { @@ -3112,6 +3122,7 @@ namespace SabreTools.Helper } sw.Write(state); + sw.Flush(); } catch (Exception ex) { @@ -3290,6 +3301,7 @@ namespace SabreTools.Helper } sw.Write(state); + sw.Flush(); } catch (Exception ex) { @@ -3354,6 +3366,7 @@ namespace SabreTools.Helper // Write the footer out sw.Write(footer); + sw.Flush(); } catch (Exception ex) { diff --git a/SabreTools.Helper/Tools/RomTools.cs b/SabreTools.Helper/Tools/RomTools.cs index 08859df5..4d04338e 100644 --- a/SabreTools.Helper/Tools/RomTools.cs +++ b/SabreTools.Helper/Tools/RomTools.cs @@ -240,7 +240,7 @@ namespace SabreTools.Helper { if (Path.GetDirectoryName(x.Name) == Path.GetDirectoryName(y.Name)) { - return Style.CompareNumeric((x.Name), Path.GetFileName(y.Name)); + return Style.CompareNumeric(Path.GetFileName(x.Name), Path.GetFileName(y.Name)); } return Style.CompareNumeric(Path.GetDirectoryName(x.Name), Path.GetDirectoryName(y.Name)); }