diff --git a/libavformat/utils.c b/libavformat/utils.c
index d98db39632eacf84a46c3561da28e6ce682bdc79..9c537f361e5404696d3701ad569e892d8f806fbf 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2239,6 +2239,7 @@ int ff_new_chapter(AVFormatContext *s, int64_t start, int64_t end, const char *t
     AVChapter *chapter = av_mallocz(sizeof(AVChapter));
     if(!chapter)
         return AVERROR(ENOMEM);
+    if (title)
     chapter->title = av_strdup(title);
     chapter->start = start;
     chapter->end = end;