Fix segfault when fetch_opt on a NULL section

This commit is contained in:
Philippe Pepiot
2010-04-13 22:48:50 +02:00
parent 8975e04777
commit 9f7f4c40e4

View File

@@ -448,12 +448,12 @@ fetch_opt_first(struct conf_sec *s, char *dfl, char *name)
{ {
struct conf_opt *o; struct conf_opt *o;
if (!name || !s) if (!name)
return opt_type_null; return opt_type_null;
else if (s)
SLIST_FOREACH(o, &s->optlist, entry) SLIST_FOREACH(o, &s->optlist, entry)
if (!strcmp(o->name, name)) if (!strcmp(o->name, name))
return string_to_opt(o->val[0]); return string_to_opt(o->val[0]);
return string_to_opt(dfl); return string_to_opt(dfl);
} }