From 915353ad5357b658f5a66f4de9631279ab74128a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sat, 31 Aug 2024 21:08:44 +0200 Subject: [PATCH] Update paintsettingsanimator.cpp Make sure we actually have a gradient before using it. Ref: #231 --- src/core/Animators/paintsettingsanimator.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/Animators/paintsettingsanimator.cpp b/src/core/Animators/paintsettingsanimator.cpp index fd5fe8cd7..bb2c2ae62 100644 --- a/src/core/Animators/paintsettingsanimator.cpp +++ b/src/core/Animators/paintsettingsanimator.cpp @@ -76,10 +76,12 @@ void PaintSettingsAnimator::prp_readProperty_impl(eReadStream& src) gradient = parentScene->getGradientWithDocumentId(gradDocId); if (!gradient) { // gradient is in a different scene gradient = parentScene->getGradientWithDocumentSceneId(gradDocId); - const auto newGrad = parentScene->createNewGradient(); - const auto clipboard = enve::make_shared(gradient); - clipboard->paste(newGrad); - gradient = newGrad; + if (gradient) { + const auto newGrad = parentScene->createNewGradient(); + const auto clipboard = enve::make_shared(gradient); + clipboard->paste(newGrad); + gradient = newGrad; + } } } setGradientVar(gradient);