face: accommodate empty InterestCallback/DataCallback/NackCallback
refs #3724
Change-Id: Iebfeae48d37d6dedbbdbca2a05730247807675d5
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);
+ }
}
/**