table: fix Measurements::get(Fib::s_emptyEntry) crash
refs #3275
Change-Id: Ie630111a3421f470756412896154f8a51f60d23d
diff --git a/daemon/table/measurements.cpp b/daemon/table/measurements.cpp
index 03c7927..247a584 100644
--- a/daemon/table/measurements.cpp
+++ b/daemon/table/measurements.cpp
@@ -67,6 +67,13 @@
Measurements::get(const fib::Entry& fibEntry)
{
shared_ptr<name_tree::Entry> nte = m_nameTree.get(fibEntry);
+ if (nte == nullptr) {
+ // must be Fib::s_emptyEntry that is unattched
+ BOOST_ASSERT(fibEntry.getPrefix().empty());
+ nte = m_nameTree.lookup(fibEntry.getPrefix());
+ }
+
+ BOOST_ASSERT(nte != nullptr);
return this->get(*nte);
}
@@ -74,6 +81,8 @@
Measurements::get(const pit::Entry& pitEntry)
{
shared_ptr<name_tree::Entry> nte = m_nameTree.get(pitEntry);
+
+ BOOST_ASSERT(nte != nullptr);
return this->get(*nte);
}