diff --git a/ChangeLog b/ChangeLog index e55adefa..bf92f807 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-11 Tatsuhiro Tsujikawa + + Added handling of dynamic cast failure. + * src/DHTNodeLookupTask.cc + * src/DHTPeerLookupTask.cc + 2008-02-11 Tatsuhiro Tsujikawa Added the ability to stop aria2 itself when given time has passed diff --git a/src/DHTNodeLookupTask.cc b/src/DHTNodeLookupTask.cc index 6c76045b..72fd0805 100644 --- a/src/DHTNodeLookupTask.cc +++ b/src/DHTNodeLookupTask.cc @@ -50,7 +50,11 @@ std::deque > DHTNodeLookupTask::getNodesFromMessage(const SharedHandle& message) { SharedHandle m = message; - return m->getClosestKNodes(); + if(m.isNull()) { + return std::deque >(); + } else { + return m->getClosestKNodes(); + } } SharedHandle diff --git a/src/DHTPeerLookupTask.cc b/src/DHTPeerLookupTask.cc index 6d2030ba..5f6152fa 100644 --- a/src/DHTPeerLookupTask.cc +++ b/src/DHTPeerLookupTask.cc @@ -59,13 +59,19 @@ DHTPeerLookupTask::DHTPeerLookupTask(const SharedHandle& btContext): std::deque > DHTPeerLookupTask::getNodesFromMessage(const SharedHandle& message) { SharedHandle m = message; - return m->getClosestKNodes(); + if(m.isNull()) { + return std::deque >(); + } else { + return m->getClosestKNodes(); + } } void DHTPeerLookupTask::onReceivedInternal(const SharedHandle& message) { SharedHandle m = message; - + if(m.isNull()) { + return; + } SharedHandle remoteNode = m->getRemoteNode(); _tokenStorage[Util::toHex(remoteNode->getID(), DHT_ID_LENGTH)] = m->getToken();