[Mplayer-cvslog] CVS: main parser-mpcmd.c,1.3,1.4

Arpi of Ize arpi at mplayerhq.hu
Wed Dec 11 21:56:57 CET 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv1199

Modified Files:
	parser-mpcmd.c 
Log Message:
more i+1<argc checks
patch by "Puk Madick" <pingy at swirvemail.com>, correction by Albeu


Index: parser-mpcmd.c
===================================================================
RCS file: /cvsroot/mplayer/main/parser-mpcmd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- parser-mpcmd.c	7 Dec 2002 20:59:33 -0000	1.3
+++ parser-mpcmd.c	11 Dec 2002 20:56:37 -0000	1.4
@@ -238,7 +238,7 @@
 	  m_option_t* mp_opt = NULL;
 	  play_tree_t* entry = NULL;
 
-	  tmp = is_entry_option(opt,argv[i + 1],&entry);
+	  tmp = (i+1<argc) ? is_entry_option(opt,argv[i + 1],&entry) : 0;
 	  if(tmp > 0)  { // It's an entry
 	    if(entry) {
 	      add_entry(entry);
@@ -251,9 +251,10 @@
 	    mp_opt = m_config_get_option(config,opt);
 	    if (mp_opt != NULL) { // Option exist
 	      if(mode == GLOBAL || (mp_opt->flags & M_OPT_GLOBAL))
-		tmp = m_config_set_option(config, opt, argv[i + 1]);
+                tmp = (i+1<argc) ? m_config_set_option(config, opt, argv[i + 1])
+				 : m_config_set_option(config, opt, NULL);
 	      else {
-		tmp = m_config_check_option(config, opt, argv[i + 1]);
+		tmp = (i+1<argc) ? m_config_check_option(config, opt, argv[i + 1]) : -1;
 		if(tmp >= 0 && mode != DROP_LOCAL) {
 		  play_tree_t* pt = last_entry ? last_entry : last_parent;
 		  play_tree_set_param(pt,opt, argv[i + 1]);




More information about the MPlayer-cvslog mailing list