diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 60993276f5aac2ed73cde5c2ce6940d2a07a0a2e..045b82306e0659347136901b8a7f2a37607ed280 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -110,7 +110,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
         return AVERROR(EIO);
     }
 
-    if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
+    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
         av_log(s1, AV_LOG_ERROR, "AVParameters don't have video size and/or rate. Use -s and -r.\n");
         return AVERROR(EIO);
     }