Avoid crash when $HOME is not set

This commit is contained in:
Keith Packard 2003-02-06 19:30:32 +00:00
parent 48092073dd
commit dda27aa9ee
1 changed files with 2 additions and 1 deletions

View File

@ -428,9 +428,10 @@ FcStrCopyFilename (const FcChar8 *s)
if (*s == '~')
{
FcChar8 *home = (FcChar8 *) getenv ("HOME");
int size = strlen ((char *) home) + strlen ((char *) s);
int size;
if (!home)
return 0;
size = strlen ((char *) home) + strlen ((char *) s);
new = (FcChar8 *) malloc (size);
if (!new)
return 0;