src: Check validity of FaceURIs while loading conf

refs: #2070

Change-Id: I2278ab0a6367910495208a48c801f3af83bd43ec
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index b3067a3..9a100ec 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -25,6 +25,7 @@
 #include <fstream>
 
 #include <ndn-cxx/name.hpp>
+#include <ndn-cxx/util/face-uri.hpp>
 
 // boost needs to be included after ndn-cxx, otherwise there will be conflict with _1, _2, ...
 #include <boost/algorithm/string.hpp>
@@ -499,6 +500,14 @@
         ConfigSection CommandAttriTree = tn->second;
         std::string name = CommandAttriTree.get<std::string>("name");
         std::string faceUri = CommandAttriTree.get<std::string>("face-uri");
+
+        ndn::util::FaceUri uri;
+
+        if (!uri.parse(faceUri)) {
+          std::cerr << "Malformed face-uri <" << faceUri << "> for " << name << std::endl;
+          return false;
+        }
+
         double linkCost = CommandAttriTree.get<double>("link-cost",
                                                        Adjacent::DEFAULT_LINK_COST);
         ndn::Name neighborName(name);
@@ -671,4 +680,4 @@
   return true;
 }
 
-} // namespace nlsr
\ No newline at end of file
+} // namespace nlsr