From 13af2442d3e1111e7404f84201398cf4f241456e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 21 Feb 2018 10:09:18 -0800 Subject: [PATCH] [Listxml] Fix read and write --- SabreTools.Library/DatFiles/Listxml.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SabreTools.Library/DatFiles/Listxml.cs b/SabreTools.Library/DatFiles/Listxml.cs index 52876feb..e22ac69e 100644 --- a/SabreTools.Library/DatFiles/Listxml.cs +++ b/SabreTools.Library/DatFiles/Listxml.cs @@ -97,6 +97,7 @@ namespace SabreTools.Library.DatFiles xtr.Read(); break; // We want to process the entire subtree of the machine + case "game": // Some older DATs still use "game" case "machine": ReadMachine(xtr.ReadSubtree(), filename, sysid, srcid, keep, clean, remUnicode); @@ -717,9 +718,12 @@ namespace SabreTools.Library.DatFiles + (rom.Year != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Year) + "\n" : "") + (rom.Publisher != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Publisher) + "\n" : ""); - foreach (Tuple kvp in rom.Infos) + if (rom.Infos != null && rom.Infos.Count > 0) { - state += "\t\t\n"; + foreach (Tuple kvp in rom.Infos) + { + state += "\t\t\n"; + } } sw.Write(state);