src/node/node.cc
changeset 3513 fe3945d67a88
parent 3460 99698bc858e8
child 3514 308a7d84b18f
--- a/src/node/node.cc	Tue Aug 05 19:46:05 2008 +0100
+++ b/src/node/node.cc	Wed Aug 06 16:06:44 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 (n < m_devices.size (), "Device index " << n <<
+                 " 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 (n < m_applications.size (), "Application index " << n <<
+                 " is out of range (only have " << m_applications.size () << " applications).");
   return m_applications[index];
 }
 uint32_t