src/node/node.cc
changeset 1195 53f1175dbe94
parent 1194 b8e957eb0a94
child 1229 e4cfe4094c10
--- a/src/node/node.cc	Wed Aug 01 12:33:44 2007 +0200
+++ b/src/node/node.cc	Wed Aug 01 13:53:48 2007 +0200
@@ -79,8 +79,8 @@
 uint32_t 
 Node::AddDevice (Ptr<NetDevice> device)
 {
+  uint32_t index = m_devices.size ();
   m_devices.push_back (device);
-  uint32_t index = m_devices.size ();
   device->SetIfIndex(index);
   device->SetReceiveCallback (MakeCallback (&Node::ReceiveFromDevice, this));
   NotifyDeviceAdded (device);
@@ -89,14 +89,7 @@
 Ptr<NetDevice>
 Node::GetDevice (uint32_t index) const
 {
-  if (index == 0)
-    {
-      return 0;
-    }
-  else
-    {
-      return m_devices[index - 1];
-    }
+  return m_devices[index];
 }
 uint32_t 
 Node::GetNDevices (void) const