Fix T49028: crash when copying a scene without grease pencil data.
authorKévin Dietrich <kevin.dietrich@mailoo.org>
Sat, 6 Aug 2016 10:43:37 +0000 (12:43 +0200)
committerKévin Dietrich <kevin.dietrich@mailoo.org>
Sat, 6 Aug 2016 10:43:52 +0000 (12:43 +0200)
source/blender/editors/object/object_relations.c

index ff2accf9d82d3843e5dc3d5be2544964a35b1764..52fc07f386756900bf2bfceb8477f33aa22844dd 100644 (file)
@@ -1764,10 +1764,13 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
                                        /* copy already clears */
                                }
                                /* remap gpencil parenting */
-                               bGPdata *gpd = scene->gpd;
-                               for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-                                       if (gpl->parent == ob) {
-                                               gpl->parent = obn;
+
+                               if (scene->gpd) {
+                                       bGPdata *gpd = scene->gpd;
+                                       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+                                               if (gpl->parent == ob) {
+                                                       gpl->parent = obn;
+                                               }
                                        }
                                }