Fix bug that catalog crashes when no security section in publishAdapter of config file

Change-Id: I7d9c27490270a8a79ec7258511d74b1620ecf69c
diff --git a/catalog/src/publish/publish-adapter.hpp b/catalog/src/publish/publish-adapter.hpp
index 5dd9206..aa61845 100644
--- a/catalog/src/publish/publish-adapter.hpp
+++ b/catalog/src/publish/publish-adapter.hpp
@@ -156,7 +156,7 @@
    * @param data: shared pointer for the fetched update data
    */
   void
-  processUpdateData(const ndn::shared_ptr<const ndn::Data>& data);
+  processUpdateData(const std::shared_ptr<const ndn::Data>& data);
 
   /**
    * Helper function that add data to or remove data from database
@@ -539,14 +539,20 @@
   if (data.getContent().empty()) {
     return;
   }
-  m_publishValidator->validate(data,
-                               bind(&PublishAdapter<DatabaseHandler>::validatePublishedDataPaylod, this, _1),
-                               bind(&PublishAdapter<DatabaseHandler>::onValidationFailed, this, _1, _2));
+  if (m_publishValidator != nullptr) {
+    m_publishValidator->validate(data,
+                                 bind(&PublishAdapter<DatabaseHandler>::validatePublishedDataPaylod, this, _1),
+                                 bind(&PublishAdapter<DatabaseHandler>::onValidationFailed, this, _1, _2));
+  }
+  else {
+    std::shared_ptr<ndn::Data> dataPtr = std::make_shared<ndn::Data>(data);
+    validatePublishedDataPaylod(dataPtr);
+  }
 }
 
 template <typename DatabaseHandler>
 void
-PublishAdapter<DatabaseHandler>::validatePublishedDataPaylod(const ndn::shared_ptr<const ndn::Data>& data)
+PublishAdapter<DatabaseHandler>::validatePublishedDataPaylod(const std::shared_ptr<const ndn::Data>& data)
 {
   _LOG_DEBUG(">> PublishAdapter::onValidatePublishedDataPayload");
 
@@ -594,7 +600,7 @@
 
 template <typename DatabaseHandler>
 void
-PublishAdapter<DatabaseHandler>::processUpdateData(const ndn::shared_ptr<const ndn::Data>& data)
+PublishAdapter<DatabaseHandler>::processUpdateData(const std::shared_ptr<const ndn::Data>& data)
 {
   _LOG_DEBUG(">> PublishAdapter::processUpdateData");