Fix unexpected "/" path after normalizing empty directory path

Caused problems in the Asset Browser branch when passing an empty path. The
function shouldn't blindly add a slash but sanity-check the input parameters
first.
This commit is contained in:
Julian Eisel 2020-12-08 12:37:46 +01:00
parent c0bd240ad0
commit 296bc35638
1 changed files with 5 additions and 0 deletions

View File

@ -264,6 +264,11 @@ void BLI_path_normalize(const char *relabase, char *path)
*/
void BLI_path_normalize_dir(const char *relabase, char *dir)
{
/* Would just create an unexpected "/" path, just early exit entirely. */
if (dir[0] == '\0') {
return;
}
BLI_path_normalize(relabase, dir);
BLI_path_slash_ensure(dir);
}