tgf/tgf.cpp: Return empty tgtPath on empty srcPath

Otherwise, even if srcPath is empty, a trailing '/' would be appended to
tgtPath, and therefore it would not be possible to get an empty data
directory if SD_DATADIR is undefined or empty.
This commit is contained in:
Xavier Del Campo Romero 2024-12-30 08:40:37 +01:00
parent 522022fe1f
commit d831bacfba
Signed by: xavi
GPG key ID: 84FF3612A9BF43F2

View file

@ -840,7 +840,7 @@ static char* makeRunTimeDirPath(const char* srcPath)
strcpy(tgtPath, srcPath);
// Fix \ and add a trailing / is needed.
if (tgtPath)
if (tgtPath && strlen(tgtPath))
GfPathNormalizeDir(tgtPath, bufSize - 1);
if (!tgtPath)