diff --git a/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java
index 7222bddac..6c1331b14 100644
--- a/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java
+++ b/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java
@@ -325,12 +325,15 @@ public class GSAResponseWriter implements QueryResponseWriter {
}
public static String highlight(String text, String query) {
- String[] q = CommonPattern.SPACE.split(CommonPattern.PLUS.matcher(query.trim().toLowerCase()).replaceAll(" "));
- for (String s: q) {
- int p = text.toLowerCase().indexOf(s.toLowerCase());
- if (p < 0) continue;
- text = text.substring(0, p) + "" + text.substring(p, p + s.length()) + "" + text.substring(p + s.length());
- }
- return text.replaceAll(Pattern.quote(" "), " ");
+ if (query != null) {
+ String[] q = CommonPattern.SPACE.split(CommonPattern.PLUS.matcher(query.trim().toLowerCase()).replaceAll(" "));
+ for (String s: q) {
+ int p = text.toLowerCase().indexOf(s.toLowerCase());
+ if (p < 0) continue;
+ text = text.substring(0, p) + "" + text.substring(p, p + s.length()) + "" + text.substring(p + s.length());
+ }
+ return text.replaceAll(Pattern.quote(" "), " ");
+ }
+ return text;
}
}
\ No newline at end of file