merge
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 06 Aug 2008 18:01:53 +0100
changeset 3524 149adba9cc96
parent 3523 118a0ac0ecfa (current diff)
parent 3515 88e9cee20461 (diff)
child 3525 ad96d4d968b0
merge
--- 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