Handle cases using "of-as-game" where those values are null (Fixes #12)

This commit is contained in:
Matt Nadareski
2019-05-21 12:52:34 -07:00
parent adf225cf01
commit 312e8a778c

View File

@@ -155,15 +155,13 @@ namespace SabreTools.Library.DatFiles
{
string needleString = needle as string;
string strawString = straw as string;
if (!String.IsNullOrWhiteSpace(strawString))
if (!String.IsNullOrWhiteSpace(strawString) && needleString != null)
{
string regexStraw = strawString;
// If the straw has no special characters at all, treat it as an exact match
if (regexStraw == Regex.Escape(regexStraw))
{
regexStraw = "^" + regexStraw + "$";
}
// Check if a match is found with the regex
found |= Regex.IsMatch(needleString, regexStraw, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);