Fixes npe when no subjects in location
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 3 Jul 2013 11:25:01 +0000 (07:25 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 3 Jul 2013 11:25:01 +0000 (07:25 -0400)
src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java

index 8cbfb90..57e72a6 100644 (file)
@@ -40,12 +40,14 @@ public class Location extends ResponseDataObject {
   \r
   public String getSubjects() {\r
     StringBuilder builder = new StringBuilder("");\r
-    for (ResponseDataObject data : getElements("md-subject")) {\r
-      if (builder.length()==0) {\r
-        builder.append(data.getValue());\r
-      } else {\r
-        builder.append(", ");\r
-        builder.append(data.getValue());\r
+    if (getElements("md-subject") != null) {\r
+      for (ResponseDataObject data : getElements("md-subject")) {\r
+        if (builder.length()==0) {\r
+          builder.append(data.getValue());\r
+        } else {\r
+          builder.append(", ");\r
+          builder.append(data.getValue());\r
+        }\r
       }\r
     }\r
     return builder.toString();\r