diff --git a/libavformat/mov.c b/libavformat/mov.c
index 198f3cd..8170004 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1563,7 +1563,9 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     av_dlog(c->fc, "track[%i].stts.entries = %i\n",
             c->fc->nb_streams-1, entries);
 
-    if (!entries || entries >= UINT_MAX / sizeof(*sc->stts_data))
+    if (!entries)
+        return 0;
+    if (entries >= UINT_MAX / sizeof(*sc->stts_data))
         return AVERROR(EINVAL);
 
     sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
