diff options
author | Julian Eisel <julian@blender.org> | 2020-12-08 14:37:46 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-08 14:42:02 +0300 |
commit | 296bc35638605b6172ccd058628e0d27258a5f5f (patch) | |
tree | 0cba69a17f48d17b39e64b31fcfc14aaccece330 /source/blender/blenlib/intern/path_util.c | |
parent | c0bd240ad0a17402db9d2e4799a433b81b62fca8 (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 758feef6093..74bbe59bc04 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -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); } |