diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-17 15:21:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-17 15:59:07 +0300 |
commit | 117a5c0ac75a5c96dff3873bed93bd55f76192f2 (patch) | |
tree | e395fae51c47461232433491759c394e84e85c6d | |
parent | 6d8e36b72355fd8642beca9c400388e9e2906f21 (diff) |
Fix Python error removing studio lights in user preferences.
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 8 |
2 files changed, 12 insertions, 5 deletions
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) |