changeset 10601:57b5e42f6a35

Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
author alex
date Wed, 13 Aug 2003 21:32:28 +0000
parents 3cf428b56cde
children a4fb8d7831de
files libmpdemux/open.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/open.c	Wed Aug 13 21:04:15 2003 +0000
+++ b/libmpdemux/open.c	Wed Aug 13 21:32:28 2003 +0000
@@ -535,7 +535,8 @@
 int dvd_parse_chapter_range(m_option_t *conf, const char *range){
   const char *s;
   char *t;
-/*  conf; prevent warning from GCC */
+  if (!range)
+    return M_OPT_MISSING_PARAM;
   s = range;
   dvd_chapter = 1;
   dvd_last_chapter = 0;
@@ -543,26 +544,26 @@
     dvd_chapter = strtol(range, &s, 10);
     if (range == s) {
       mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
-      return -1;
+      return M_OPT_INVALID;
     }
   }
   if (*s == 0)
     return 0;
   else if (*s != '-') {
     mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
-    return -1;
+    return M_OPT_INVALID;
   }
   ++s;
   if (*s == 0)
       return 0;
   if (! isdigit(*s)) {
     mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
-    return -1;
+    return M_OPT_INVALID;
   }
   dvd_last_chapter = strtol(s, &t, 10);
   if (s == t || *t)  {
     mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
-    return -1;
+    return M_OPT_INVALID;
   }
   return 0;
 }