mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Handle cases using "of-as-game" where those values are null (Fixes #12)
This commit is contained in:
@@ -155,15 +155,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
string needleString = needle as string;
|
string needleString = needle as string;
|
||||||
string strawString = straw as string;
|
string strawString = straw as string;
|
||||||
if (!String.IsNullOrWhiteSpace(strawString))
|
if (!String.IsNullOrWhiteSpace(strawString) && needleString != null)
|
||||||
{
|
{
|
||||||
string regexStraw = strawString;
|
string regexStraw = strawString;
|
||||||
|
|
||||||
// If the straw has no special characters at all, treat it as an exact match
|
// If the straw has no special characters at all, treat it as an exact match
|
||||||
if (regexStraw == Regex.Escape(regexStraw))
|
if (regexStraw == Regex.Escape(regexStraw))
|
||||||
{
|
|
||||||
regexStraw = "^" + regexStraw + "$";
|
regexStraw = "^" + regexStraw + "$";
|
||||||
}
|
|
||||||
|
|
||||||
// Check if a match is found with the regex
|
// Check if a match is found with the regex
|
||||||
found |= Regex.IsMatch(needleString, regexStraw, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
found |= Regex.IsMatch(needleString, regexStraw, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
|
|||||||
Reference in New Issue
Block a user