Skip to content

Commit 2c6d8d0

Browse files
committed
Fix NPE when replacing unexisting strings
1 parent 3f07b8a commit 2c6d8d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arduino-core/src/processing/app/helpers/StringReplacer.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public static String replaceFromMapping(String src, Map<String, String> map,
9494
String rightDelimiter) {
9595
for (Map.Entry<String, String> entry : map.entrySet()) {
9696
String keyword = leftDelimiter + entry.getKey() + rightDelimiter;
97-
src = src.replace(keyword, entry.getValue());
97+
if (entry.getValue() != null && keyword != null) {
98+
src = src.replace(keyword, entry.getValue());
99+
}
98100
}
99101
return src;
100102
}

0 commit comments

Comments
 (0)