Fixed valgrind errors in attribute system. Fixed typo in AttributeMap test. Fixed Get() method for elements not present in the map
--- a/src/core/model/object-ptr-container.cc Fri May 11 16:42:40 2012 +0200
+++ b/src/core/model/object-ptr-container.cc Mon May 14 18:15:22 2012 +0200
@@ -43,7 +43,13 @@
Ptr<Object>
ObjectPtrContainerValue::Get (uint32_t i) const
{
- return m_objects.find (i)->second;
+ Iterator it = m_objects.find (i);
+ Ptr<Object> value = 0;
+ if ( it != m_objects.end () )
+ {
+ value = m_objects.find (i)->second;
+ }
+ return value;
}
Ptr<AttributeValue>
--- a/src/core/test/attribute-test-suite.cc Fri May 11 16:42:40 2012 +0200
+++ b/src/core/test/attribute-test-suite.cc Mon May 14 18:15:22 2012 +0200
@@ -780,7 +780,7 @@
//
// Get the Object pointer from the value.
//
- Ptr<Object> a = map.Get (0);
+ Ptr<Object> a = map.Get (1);
NS_TEST_ASSERT_MSG_NE (a, 0, "Ptr<Object> from VectorValue \"TestMap1\" is zero");
//