diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-11-27 16:28:12 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-11-27 16:33:48 +0300 |
commit | e2d223461efeea4792defb254c692828266478d1 (patch) | |
tree | af99daf08d8c8c908630a476c933474b37c87a6b | |
parent | d20f5b7de0975a9f18d4ab34a5d9f5092c7e9900 (diff) |
Fix T50123 - GreasePencil: Modifying name of new color in new palette via bpy segfaults
When there were no prior palettes, creating a new one didn't automatically make it active.
This caused problems when trying to rename the color, as the RNA code assumed that if there's
a color, it must come from the active palette.
This commit partially fixes the problem by ensuring that if there are no palettes, the first
one will always be made active.
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 2242113b79b..c22fd0e5a3c 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -382,7 +382,8 @@ bGPDpalette *BKE_gpencil_palette_addnew(bGPdata *gpd, const char *name, bool set sizeof(palette->info)); /* make this one the active one */ - if (setactive) { + /* NOTE: Always make this active if there's nothing else yet (T50123) */ + if ((setactive) || (gpd->palettes.first == gpd->palettes.last)) { BKE_gpencil_palette_setactive(gpd, palette); } |