Ipv4Endpoint: Add 2 tests to verify the existence of the callback before calling it.
--- a/src/internet/model/ipv4-end-point.cc Wed Jan 09 13:45:23 2013 +0100
+++ b/src/internet/model/ipv4-end-point.cc Wed Jan 09 14:13:15 2013 +0100
@@ -123,7 +123,10 @@
Ipv4EndPoint::DoForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport,
Ptr<Ipv4Interface> incomingInterface)
{
- m_rxCallback (p, header, sport, incomingInterface);
+ if (!m_rxCallback.IsNull ())
+ {
+ m_rxCallback (p, header, sport, incomingInterface);
+ }
}
void
@@ -144,7 +147,10 @@
uint8_t icmpType, uint8_t icmpCode,
uint32_t icmpInfo)
{
- m_icmpCallback (icmpSource,icmpTtl,icmpType,icmpCode,icmpInfo);
+ if (!m_icmpCallback.IsNull ())
+ {
+ m_icmpCallback (icmpSource,icmpTtl,icmpType,icmpCode,icmpInfo);
+ }
}
} // namespace ns3