Skip to content

Commit b0c6e82

Browse files
Added null/empty string check. This fixes an error in StringFunction if target string ends in a space character.
1 parent 3b33593 commit b0c6e82

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

AIProgrammer.Functions/Concrete/StringFunction.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ public string Generate(IGeneticAlgorithm ga)
5151
Dictionary<string, string> terms = new Dictionary<string, string>();
5252
foreach (string part in parts)
5353
{
54-
terms[part] = part;
54+
if (!string.IsNullOrEmpty(part))
55+
{
56+
terms[part] = part;
57+
}
5558
}
5659

5760
foreach (string term in terms.Values)

0 commit comments

Comments
 (0)