diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c
index 4a599a0059d01097cc2f660282e5d76c6cface5c..21ac2111962a8920521068f16ce5b02a0846111c 100644
--- a/src/xpdev/ini_file.c
+++ b/src/xpdev/ini_file.c
@@ -506,6 +506,7 @@ static str_list_t splitList(char* list, const char* sep)
 
 	token=strtok(list,sep);
 	while(token!=NULL) {
+		SKIP_WHITESPACE(token);
 		truncsp(token);
 		if(strListAppend(&lp,token,items++)==NULL)
 			break;
@@ -525,6 +526,9 @@ str_list_t iniReadStringList(FILE* fp, const char* section, const char* key
 	if((value=read_value(fp,section,key,buf))==NULL || *value==0 /* blank */)
 		value=(char*)deflt;
 
+	if(value==NULL)
+		return(NULL);
+
 	SAFECOPY(list,value);
 
 	return(splitList(list,sep));