diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index fcdaf834bc7ed7bc035e2e1e103e5ce05a885d62..6a80a1576792d7397272e3ee849cec1ccf8ec492 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -308,7 +308,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
                                 palette_idx1 = buf[stream_ptr++];
                                 pixels[pixel_ptr++] = palette_idx1;
                             }
-                        } else {
+                        } else if (byte_run < 0) {
                             byte_run = -byte_run;
                             palette_idx1 = buf[stream_ptr++];
                             CHECK_PIXEL_PTR(byte_run);