Packets: BUGFIX: next<> and prev<> now correctly handle in-valid() returns
g0dil [Thu, 17 Jan 2008 13:44:20 +0000 (13:44 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@617 270642c3-0616-0410-b53a-bc976706d245

Packets/Packet.cti

index 18443fa..ed032da 100644 (file)
@@ -69,14 +69,16 @@ template <class OtherPacket>
 prefix_ OtherPacket senf::Packet::next()
     const
 {
-    return next().as<OtherPacket>();
+    Packet p (next())
+    return p ? p.as<OtherPacket>() : OtherPacket();
 }
 
 template <class OtherPacket>
 prefix_ OtherPacket senf::Packet::prev()
     const
 {
-    return prev().as<OtherPacket>();
+    Packet p (prev());
+    return p ? p.as<OtherPacket>() : OtherPacket();
 }
 
 template <class OtherPacket>