Howtos/NewPacket: Small fixes
[senf.git] / PPI / Connectors.cti
index a957c92..b8f5bf3 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institute for Open Communication Systems (FOKUS) 
-// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -37,14 +37,15 @@ template <class Self, class PacketType>
 prefix_ typename senf::ppi::connector::detail::TypedInputMixin<Self,PacketType>::Type
 senf::ppi::connector::detail::TypedInputMixin<Self,PacketType>::operator()()
 {
-    return static_cast<Self*>(this)->InputConnector::operator()().template as<Type>();
+    return read();
 }
 
 template <class Self, class PacketType>
 prefix_ typename senf::ppi::connector::detail::TypedInputMixin<Self,PacketType>::Type
 senf::ppi::connector::detail::TypedInputMixin<Self,PacketType>::read()
 {
-    return static_cast<Self*>(this)->InputConnector::read().template as<Type>();
+    Packet p (static_cast<Self*>(this)->InputConnector::read());
+    return p ? p.as<Type>() : Type();
 }
 
 ///////////////////////////////////////////////////////////////////////////