From fc5cd8e466d5b2a90a7f21d5e1f5eb06c8ff787a Mon Sep 17 00:00:00 2001 From: John Abraham Date: Wed, 31 Oct 2012 23:17:27 -0700 Subject: [PATCH] NetAnim: Skip ipaddress check if index cannot be found --- src/netanim/model/animation-interface.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 748cd5f5a..70a97dd2c 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -363,7 +363,12 @@ std::string AnimationInterface::GetIpv4Address (Ptr nd) Ptr ipv4 = NodeList::GetNode (nd->GetNode ()->GetId ())->GetObject (); if (!ipv4) return "0.0.0.0"; - uint32_t ifIndex = ipv4->GetInterfaceForDevice (nd); + int32_t ifIndex = ipv4->GetInterfaceForDevice (nd); + if (ifIndex == -1) + { + NS_LOG_WARN ("Node :" << nd->GetNode ()->GetId () << " Could not find index of NetDevice"); + return "0.0.0.0"; + } Ipv4InterfaceAddress addr = ipv4->GetAddress (ifIndex, 0); std::ostringstream oss; oss << addr.GetLocal ();