--- a/src/node/node-list.cc Wed Aug 06 17:55:01 2008 +0100
+++ b/src/node/node-list.cc Wed Aug 06 18:01:53 2008 +0100
@@ -23,6 +23,7 @@
#include "ns3/object-vector.h"
#include "ns3/config.h"
#include "ns3/log.h"
+#include "ns3/assert.h"
#include "node-list.h"
#include "node.h"
@@ -140,6 +141,8 @@
Ptr<Node>
NodeListPriv::GetNode (uint32_t n)
{
+ NS_ASSERT_MSG (n < m_nodes.size (), "Node index " << n <<
+ " is out of range (only have " << m_nodes.size () << " nodes).");
return m_nodes[n];
}
--- a/src/node/node.cc Wed Aug 06 17:55:01 2008 +0100
+++ b/src/node/node.cc Wed Aug 06 18:01:53 2008 +0100
@@ -27,6 +27,7 @@
#include "ns3/object-vector.h"
#include "ns3/uinteger.h"
#include "ns3/log.h"
+#include "ns3/assert.h"
NS_LOG_COMPONENT_DEFINE ("Node");
@@ -105,6 +106,8 @@
Ptr<NetDevice>
Node::GetDevice (uint32_t index) const
{
+ NS_ASSERT_MSG (index < m_devices.size (), "Device index " << index <<
+ " is out of range (only have " << m_devices.size () << " devices).");
return m_devices[index];
}
uint32_t
@@ -124,6 +127,8 @@
Ptr<Application>
Node::GetApplication (uint32_t index) const
{
+ NS_ASSERT_MSG (index < m_applications.size (), "Application index " << index <<
+ " is out of range (only have " << m_applications.size () << " applications).");
return m_applications[index];
}
uint32_t