comparison parser-mpcmd.c @ 8426:ca2813aafb35

more i+1<argc checks patch by "Puk Madick" <pingy@swirvemail.com>, correction by Albeu
author arpi
date Wed, 11 Dec 2002 20:56:37 +0000
parents 587b62cd4119
children 418b0017a8d2
comparison
equal deleted inserted replaced
8425:58063f77aa4d 8426:ca2813aafb35
236 last_parent->flags &= ~PLAY_TREE_RND; 236 last_parent->flags &= ~PLAY_TREE_RND;
237 } else { 237 } else {
238 m_option_t* mp_opt = NULL; 238 m_option_t* mp_opt = NULL;
239 play_tree_t* entry = NULL; 239 play_tree_t* entry = NULL;
240 240
241 tmp = is_entry_option(opt,argv[i + 1],&entry); 241 tmp = (i+1<argc) ? is_entry_option(opt,argv[i + 1],&entry) : 0;
242 if(tmp > 0) { // It's an entry 242 if(tmp > 0) { // It's an entry
243 if(entry) { 243 if(entry) {
244 add_entry(entry); 244 add_entry(entry);
245 if((last_parent->flags & PLAY_TREE_RND) && entry->child) 245 if((last_parent->flags & PLAY_TREE_RND) && entry->child)
246 entry->flags |= PLAY_TREE_RND; 246 entry->flags |= PLAY_TREE_RND;
249 mode = DROP_LOCAL; 249 mode = DROP_LOCAL;
250 } else if(tmp == 0) { // 'normal' options 250 } else if(tmp == 0) { // 'normal' options
251 mp_opt = m_config_get_option(config,opt); 251 mp_opt = m_config_get_option(config,opt);
252 if (mp_opt != NULL) { // Option exist 252 if (mp_opt != NULL) { // Option exist
253 if(mode == GLOBAL || (mp_opt->flags & M_OPT_GLOBAL)) 253 if(mode == GLOBAL || (mp_opt->flags & M_OPT_GLOBAL))
254 tmp = m_config_set_option(config, opt, argv[i + 1]); 254 tmp = (i+1<argc) ? m_config_set_option(config, opt, argv[i + 1])
255 : m_config_set_option(config, opt, NULL);
255 else { 256 else {
256 tmp = m_config_check_option(config, opt, argv[i + 1]); 257 tmp = (i+1<argc) ? m_config_check_option(config, opt, argv[i + 1]) : -1;
257 if(tmp >= 0 && mode != DROP_LOCAL) { 258 if(tmp >= 0 && mode != DROP_LOCAL) {
258 play_tree_t* pt = last_entry ? last_entry : last_parent; 259 play_tree_t* pt = last_entry ? last_entry : last_parent;
259 play_tree_set_param(pt,opt, argv[i + 1]); 260 play_tree_set_param(pt,opt, argv[i + 1]);
260 } 261 }
261 } 262 }