]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
packet: return zero for pktbuf_len() when pktbuf ptr is NULL
authorJaroslav Kysela <perex@perex.cz>
Tue, 13 Jan 2015 19:22:06 +0000 (20:22 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 13 Jan 2015 19:22:06 +0000 (20:22 +0100)
src/packet.h

index cf5a0f1ec42757400e40f2b164309085844e9009..df361b2d1419b666de799baa6237885840cc07ab 100644 (file)
@@ -115,7 +115,7 @@ pktbuf_t *pktbuf_make(void *data, size_t size);
 
 pktbuf_t *pktbuf_append(pktbuf_t *pb, const void *data, size_t size);
 
-static inline size_t   pktbuf_len(pktbuf_t *pb) { return pb->pb_size; }
+static inline size_t   pktbuf_len(pktbuf_t *pb) { return pb ? pb->pb_size : 0; }
 static inline uint8_t *pktbuf_ptr(pktbuf_t *pb) { return pb->pb_data; }
 
 #endif /* PACKET_H_ */