The output of toDocument() may be null and should be checked before using.

Change-Id: I9b27c2691337feb5dce421f383cf54128e399568
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java
index c92fd51..15dc248 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java
@@ -218,18 +218,20 @@
 
         for (CharSequence node : nodes) {
             Document ldoc = toDocument(CharSource.wrap(node));
-            Element cfgRoot = ldoc.getDocumentElement();
+            if (ldoc != null) {
+                Element cfgRoot = ldoc.getDocumentElement();
 
-            // is everything as merge, ok?
-            cfgRoot.setAttribute("xc:operation", "merge");
+                // is everything as merge, ok?
+                cfgRoot.setAttribute("xc:operation", "merge");
 
-            // move (or copy) node to another Document
-            config.appendChild(Optional.ofNullable(doc.adoptNode(cfgRoot))
-                                  .orElseGet(() -> doc.importNode(cfgRoot, true)));
+                // move (or copy) node to another Document
+                config.appendChild(Optional.ofNullable(doc.adoptNode(cfgRoot))
+                                           .orElseGet(() -> doc.importNode(cfgRoot, true)));
 
-            // don't have good use for JSON for now
-            //JsonNode json = toJsonNode(toJsonCompositeStream(toCompositeData(toResourceData(resourceId, node))));
-            //printlog("JSON:\n{}", toCharSequence(json));
+                // don't have good use for JSON for now
+                //JsonNode json = toJsonNode(toJsonCompositeStream(toCompositeData(toResourceData(resourceId, node))));
+                //printlog("JSON:\n{}", toCharSequence(json));
+            }
         }
 
         printlog("XML:\n{}", XmlString.prettifyXml(toCharSequence(doc)));