table: Fixing Pit::erase crash if the Interest name contains implicit digest

Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4973ac
Refs: #3608
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 3f15598..b7f83a3 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -36,7 +36,9 @@
 
 namespace name_tree {
 class Entry;
-}
+} // namespace name_tree
+
+class Pit;
 
 namespace pit {
 
@@ -183,6 +185,7 @@
 
   friend class nfd::NameTree;
   friend class nfd::name_tree::Entry;
+  friend class nfd::Pit;
 };
 
 inline const Interest&
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 12a21bd..ae5a5cd 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -113,7 +113,7 @@
 void
 Pit::erase(shared_ptr<pit::Entry> pitEntry)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(*pitEntry);
+  shared_ptr<name_tree::Entry> nameTreeEntry = pitEntry->m_nameTreeEntry;
   BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
 
   nameTreeEntry->erasePitEntry(pitEntry);