[Bf-blender-cvs] [117a5c0ac75] blender2.8: Fix Python error removing studio lights in user preferences.

Brecht Van Lommel noreply at git.blender.org
Tue Jul 17 16:52:30 CEST 2018


Commit: 117a5c0ac75a5c96dff3873bed93bd55f76192f2
Author: Brecht Van Lommel
Date:   Tue Jul 17 14:21:16 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB117a5c0ac75a5c96dff3873bed93bd55f76192f2

Fix Python error removing studio lights in user preferences.

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

M	release/scripts/startup/bl_operators/wm.py
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index cfbc96696d6..3f0cdfa606b 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2499,9 +2499,12 @@ class WM_OT_studiolight_uninstall(Operator):
         userpref = context.user_preferences
         for studio_light in userpref.studio_lights:
             if studio_light.index == self.index:
-                self._remove_path(pathlib.Path(studio_light.path))
-                self._remove_path(pathlib.Path(studio_light.path_irr_cache))
-                self._remove_path(pathlib.Path(studio_light.path_sh_cache))
+                if len(studio_light.path) > 0:
+                    self._remove_path(pathlib.Path(studio_light.path))
+                if len(studio_light.path_irr_cache) > 0:
+                    self._remove_path(pathlib.Path(studio_light.path_irr_cache))
+                if len(studio_light.path_sh_cache) > 0:
+                    self._remove_path(pathlib.Path(studio_light.path_sh_cache))
                 userpref.studio_lights.remove(studio_light)
                 return {'FINISHED'}
         return {'CANCELLED'}
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 5557afdb33f..a54462e6b3e 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -683,7 +683,9 @@ static void rna_UserDef_studiolight_path_irr_cache_get(PointerRNA *ptr, char *va
 	if (sl->path_irr_cache) {
 		BLI_strncpy(value, sl->path_irr_cache, FILE_MAX);
 	}
-	value[0] = 0x00;
+	else {
+		value[0] = '\0';
+	}
 }
 
 static int rna_UserDef_studiolight_path_irr_cache_length(PointerRNA *ptr)
@@ -702,7 +704,9 @@ static void rna_UserDef_studiolight_path_sh_cache_get(PointerRNA *ptr, char *val
 	if (sl->path_sh_cache) {
 		BLI_strncpy(value, sl->path_sh_cache, FILE_MAX);
 	}
-	value[0] = 0x00;
+	else {
+		value[0] = '\0';
+	}
 }
 
 static int rna_UserDef_studiolight_path_sh_cache_length(PointerRNA *ptr)



More information about the Bf-blender-cvs mailing list