Fix Nullpointer exception 57/91457/2
authorsebdet <sebastien.determe@intl.att.com>
Mon, 15 Jul 2019 15:13:43 +0000 (17:13 +0200)
committersebdet <sebastien.determe@intl.att.com>
Mon, 15 Jul 2019 15:27:50 +0000 (17:27 +0200)
Fix null pointer exception happening when getting a non existent SVG in
db

Issue-ID: CLAMP-424
Change-Id: I8941441b2af1ae2d54da977b467bde3abef52376
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
src/main/java/org/onap/clamp/loop/LoopController.java

index b862780..7d41e48 100644 (file)
@@ -116,12 +116,13 @@ public class LoopController {
 
     /**
      * Get the SVG representation of the loop
-     * 
+     *
      * @param loopName
      *        The loop name
      * @return The SVG representation
      */
     public String getSVGRepresentation(String loopName) {
-        return loopService.getLoop(loopName).getSvgRepresentation();
+        Loop loop = loopService.getLoop(loopName);
+        return loop != null ? loop.getSvgRepresentation() : null;
     }
 }