changeset 1590:ba2244f38a76 libavformat

dont segv is ap->device is not set, display error message
author bcoudurier
date Wed, 13 Dec 2006 10:18:38 +0000
parents d63bac8be31a
children 5b46490d0435
files x11grab.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/x11grab.c	Wed Dec 13 10:08:27 2006 +0000
+++ b/x11grab.c	Wed Dec 13 10:18:38 2006 +0000
@@ -101,6 +101,11 @@
         return AVERROR_IO;
     }
 
+    if (!ap->device) {
+        av_log(s1, AV_LOG_ERROR, "AVParameters don't specify any device. Use -vd.\n");
+        return AVERROR_IO;
+    }
+
     sscanf(ap->device, "x11:%d,%d", &x_off, &y_off);
     av_log(s1, AV_LOG_INFO, "device: %s -> x: %d y: %d width: %d height: %d\n", ap->device, x_off, y_off, ap->width, ap->height);