[Bf-blender-cvs] [296bc356386] master: Fix unexpected "/" path after normalizing empty directory path

Julian Eisel noreply at git.blender.org
Tue Dec 8 13:02:34 CET 2020


Commit: 296bc35638605b6172ccd058628e0d27258a5f5f
Author: Julian Eisel
Date:   Tue Dec 8 12:37:46 2020 +0100
Branches: master
https://developer.blender.org/rB296bc35638605b6172ccd058628e0d27258a5f5f

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.

===================================================================

M	source/blender/blenlib/intern/path_util.c

===================================================================

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);
 }



More information about the Bf-blender-cvs mailing list