diff --git a/ffplay.c b/ffplay.c
index a48891e4f28734210785684dc658a9c2fbc75397..7b208480f0dead4a45a45a696e1a4ae9890c5abf 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1591,7 +1591,9 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
         unsigned hshift = i == 0 ? 0 : av_pix_fmt_descriptors[ref->pic->format].log2_chroma_w;
         unsigned vshift = i == 0 ? 0 : av_pix_fmt_descriptors[ref->pic->format].log2_chroma_h;
 
+        if (ref->data[i]) {
         ref->data[i]    += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift);
+        }
         pic->data[i]     = ref->data[i];
         pic->linesize[i] = ref->linesize[i];
     }