check if property is NULLi, name must be not NULL

This commit is contained in:
Laurent Vivier 2007-08-26 19:17:29 +00:00
parent 54fff16a0d
commit 37d9728374

View File

@ -16,6 +16,9 @@ int config_find_entry(char *configuration, char *name, char *property)
char current_name[256]; char current_name[256];
char current_property[256]; char current_property[256];
if (name == NULL)
return -1;
while (configuration[index]) while (configuration[index])
{ {
last_index = index; last_index = index;
@ -24,8 +27,9 @@ int config_find_entry(char *configuration, char *name, char *property)
if (index == -1) if (index == -1)
return -1; return -1;
if ( (strcmp(name, current_name) == 0) && if ( (strcmp(name, current_name) == 0) &&
(strcmp(property, current_property) == 0) ) ((property == NULL) ||
return index; (strcmp(property, current_property) == 0)))
return last_index;
} }
return -1; return -1;