Skip to content

Commit 7cfff74

Browse files
author
Marcel Overdijk
committed
Fox for returning trailing empty string on Google AppEngine (https://code.google.com/p/googleappengine/issues/detail?id=13565)
1 parent 182bbf9 commit 7cfff74

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

rivescript-core/src/main/java/com/rivescript/util/StringUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ public static String join(String[] array, String delimiter) {
9696
public static String quoteMetacharacters(String str) {
9797
String[] unsafe = "\\.+*?[^]$(){}=!<>|:".split("");
9898
for (String c : unsafe) {
99-
str = str.replaceAll(Pattern.quote(c), "\\\\\\" + c);
99+
if (c != null && c.length() > 0) {
100+
str = str.replaceAll(Pattern.quote(c), "\\\\\\" + c);
101+
}
100102
}
101103
return str;
102104
}

0 commit comments

Comments
 (0)