-rw-r--r-- | libopie2/opienet/opcap.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 04b1bb1..e362883 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -825,13 +825,13 @@ OPacket* OPacketCapturer::next() qDebug( "==> OPacketCapturer::next()" ); const unsigned char* pdata = pcap_next( _pch, &header ); qDebug( "<== OPacketCapturer::next()" ); if ( _pcd ) pcap_dump( (u_char*) _pcd, &header, pdata ); - if ( header.len ) + if ( pdata && header.len ) { OPacket* p = new OPacket( dataLink(), header, pdata, 0 ); // packets shouldn't be inserted in the QObject child-parent hierarchy, // because due to memory constraints they will be deleted as soon // as possible - that is right after they have been processed // by emit() [ see below ] @@ -839,12 +839,13 @@ OPacket* OPacketCapturer::next() p->updateStats( _stats, const_cast<QObjectList*>( p->children() ) ); return p; } else { + qWarning( "OPacketCapturer::next() - no packet received!" ); return 0; } } bool OPacketCapturer::open( const QString& name, const QString& filename ) |