face: accommodate empty InterestCallback/DataCallback/NackCallback
refs #3724
Change-Id: Iebfeae48d37d6dedbbdbca2a05730247807675d5
diff --git a/src/detail/interest-filter-record.hpp b/src/detail/interest-filter-record.hpp
index c2916f8..f771d16 100644
--- a/src/detail/interest-filter-record.hpp
+++ b/src/detail/interest-filter-record.hpp
@@ -67,11 +67,14 @@
/**
* @brief invokes the InterestCallback
+ * @note This method does nothing if the Interest callback is empty
*/
void
invokeInterestCallback(const Interest& interest) const
{
- m_interestCallback(m_filter, interest);
+ if (m_interestCallback != nullptr) {
+ m_interestCallback(m_filter, interest);
+ }
}
private:
diff --git a/src/detail/pending-interest.hpp b/src/detail/pending-interest.hpp
index f21fc2e..735db80 100644
--- a/src/detail/pending-interest.hpp
+++ b/src/detail/pending-interest.hpp
@@ -76,20 +76,26 @@
/**
* @brief invokes the Data callback
+ * @note This method does nothing if the Data callback is empty
*/
void
invokeDataCallback(const Data& data)
{
- m_dataCallback(*m_interest, data);
+ if (m_dataCallback != nullptr) {
+ m_dataCallback(*m_interest, data);
+ }
}
/**
* @brief invokes the Nack callback
+ * @note This method does nothing if the Nack callback is empty
*/
void
invokeNackCallback(const lp::Nack& nack)
{
- m_nackCallback(*m_interest, nack);
+ if (m_nackCallback != nullptr) {
+ m_nackCallback(*m_interest, nack);
+ }
}
/**