Ignore empty <dir></dir> elements

An empty element would cause every file starting with the current
directory to be scanned, probably not what the user wanted.
This commit is contained in:
Keith Packard 2008-05-24 17:14:24 -07:00
parent 83c5c357ab
commit 8ade236923
1 changed files with 3 additions and 1 deletions

View File

@ -2101,7 +2101,9 @@ FcEndElement(void *userData, const XML_Char *name)
strcat (data, "fonts");
}
#endif
if (!FcStrUsesHome (data) || FcConfigHome ())
if (strlen ((char *) data) == 0)
FcConfigMessage (parse, FcSevereWarning, "empty font directory name ignored");
else if (!FcStrUsesHome (data) || FcConfigHome ())
{
if (!FcConfigAddDir (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory; cannot add directory %s", data);