diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 0f97c259cbd4989cfa1ea01b0aa72565e70145cb..38b423101c36122b583d4690f4c4aeaf57523503 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -174,7 +174,7 @@ int av_bsf_init(AVBSFContext *ctx)
 
 int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
 {
-    if (!pkt) {
+    if (!pkt || (!pkt->data && !pkt->side_data_elems)) {
         ctx->internal->eof = 1;
         return 0;
     }