diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/Strings.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/Strings.java index 0e6e309832f..8c80868c94b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/Strings.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/Strings.java @@ -1007,6 +1007,9 @@ public class Strings { } public static String[] splitStringToArray(final String s, final char c) { + if (s.length() == 0) { + return Strings.EMPTY_ARRAY; + } final char[] chars = s.toCharArray(); int count = 1; for (final char x : chars) {