route: Fix component appending in NamePrefixTable::removeEntry
refs: #2322
Change-Id: I511414be322dccc713d3eaef737edd87a51e8b51
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index 5db64d3..ba7dd75 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -81,15 +81,17 @@
m_table.end(),
ndn::bind(&npteCompare, _1, name));
if (it != m_table.end()) {
- ndn::Name destRouter = rte.getDestination();
- (*it).removeRoutingTableEntry(rte);
- if (((*it).getRteListSize() == 0) &&
- (!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/" + NameLsa::TYPE_STRING),
- (NameLsa::TYPE_STRING))) &&
- (!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/" + AdjLsa::TYPE_STRING),
- (AdjLsa::TYPE_STRING))) &&
- (!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/" + CoordinateLsa::TYPE_STRING),
- (CoordinateLsa::TYPE_STRING)))) {
+ const ndn::Name destRouter = rte.getDestination();
+ it->removeRoutingTableEntry(rte);
+
+ if (it->getRteListSize() == 0 &&
+ !m_nlsr.getLsdb().doesLsaExist(ndn::Name(destRouter).append(NameLsa::TYPE_STRING),
+ NameLsa::TYPE_STRING) &&
+ !m_nlsr.getLsdb().doesLsaExist(ndn::Name(destRouter).append(AdjLsa::TYPE_STRING),
+ AdjLsa::TYPE_STRING) &&
+ !m_nlsr.getLsdb().doesLsaExist(ndn::Name(destRouter).append(CoordinateLsa::TYPE_STRING),
+ CoordinateLsa::TYPE_STRING))
+ {
m_table.erase(it);
m_nlsr.getFib().remove(name);
}