fw: SelfLearningStrategy: check if PIT out-record exists
Refs: #5022
Change-Id: Ib4c5288b2b48a65350fbbd6b38892c72aba00f86
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index a77d3ef..20fc28d 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -103,7 +103,13 @@
SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
const FaceEndpoint& ingress, const Data& data)
{
- OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(ingress.face)->getStrategyInfo<OutRecordInfo>();
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
+ if (outRecord == pitEntry->out_end()) {
+ NFD_LOG_DEBUG("Data " << data.getName() << " from=" << ingress << " no out-record");
+ return;
+ }
+
+ OutRecordInfo* outRecordInfo = outRecord->getStrategyInfo<OutRecordInfo>();
if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
sendDataToAll(pitEntry, ingress, data);