From 4f660317140fc6b939be8aee27bc324a470b68be Mon Sep 17 00:00:00 2001 From: Falk David Date: Thu, 10 Aug 2023 16:05:17 +0200 Subject: [PATCH] GPv3: Fix TreeNode::parent_group() for root group For the root group, the parent is `nullptr` so calling `parent_group()` would fail. This fixes the issue by adding a null check and returning `nullptr` otherwise. --- source/blender/blenkernel/intern/grease_pencil.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/grease_pencil.cc b/source/blender/blenkernel/intern/grease_pencil.cc index cb43d0f83ac..1ef2e95d950 100644 --- a/source/blender/blenkernel/intern/grease_pencil.cc +++ b/source/blender/blenkernel/intern/grease_pencil.cc @@ -481,7 +481,10 @@ Layer &TreeNode::as_layer_for_write() LayerGroup *TreeNode::parent_group() const { - return &this->parent->wrap(); + if (this->parent) { + return &this->parent->wrap(); + } + return nullptr; } LayerMask::LayerMask()