From 598041efb068be442ee8d2ab94e0da94f59818f2 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 2 Apr 2016 21:45:39 -0700 Subject: [PATCH] Fix imports of malformed XML by skipping errors Also ended up adding an error to tell the users to double check their input file --- DATabase/Core/Import.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/DATabase/Core/Import.cs b/DATabase/Core/Import.cs index 5f221014..9e49c790 100644 --- a/DATabase/Core/Import.cs +++ b/DATabase/Core/Import.cs @@ -356,6 +356,15 @@ namespace SabreTools } else { + // There are rare cases where a malformed XML will not have the required attributes. We can only skip them. + if (node.Attributes.Count == 0) + { + _logger.Error(@"A node with malformed XML has been found! + For RV DATs, please make sure that all names and descriptions are quoted. + For XML DATs, make sure that the DAT has all required information."); + node = node.NextSibling; + continue; + } tempname = node.Attributes["name"].Value; }