From 7f626e8ad21b1126773cc0d88b774b3fd19953f8 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 19 Apr 2016 14:41:00 -0700 Subject: [PATCH] Empty strings are bad when parsing --- SabreHelper/Converters.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SabreHelper/Converters.cs b/SabreHelper/Converters.cs index 5494f9b8..5ce77297 100644 --- a/SabreHelper/Converters.cs +++ b/SabreHelper/Converters.cs @@ -31,7 +31,7 @@ namespace SabreTools.Helper string line = filecontents[k]; // Comments in RV DATs start with a # - if (line.StartsWith("#")) + if (line.Trim().StartsWith("#")) { continue; } @@ -67,8 +67,13 @@ namespace SabreTools.Helper string attrib = "", val = ""; for (int i = 2; i < gc.Length; i++) { + //If the item is empty, we automatically skip it because it's a fluke + if (gc[i].Trim() == String.Empty) + { + continue; + } // Even number of quotes, not in a quote, not in attribute - if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "") + else if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "") { attrib = gc[i].Replace("\"", ""); }