Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-12-08 14:37:46 +0300
committerJulian Eisel <julian@blender.org>2020-12-08 14:42:02 +0300
commit296bc35638605b6172ccd058628e0d27258a5f5f (patch)
tree0cba69a17f48d17b39e64b31fcfc14aaccece330
parentc0bd240ad0a17402db9d2e4799a433b81b62fca8 (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.
-rw-r--r--source/blender/blenlib/intern/path_util.c5
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);
}