Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Make asserts softer in IccColorProfile

Dmitry Kazakov2d989aa34298
diff --git a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
index 0852a79d22..a9aa9a3021 100644
--- a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
+++ b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
@@ -107,7 +107,9 @@ IccColorProfile::IccColorProfile(const QVector<double> &colorants,
const TransferCharacteristics transferFunction)
: KoColorProfile(QString()), d(new Private)
{
- KIS_ASSERT(
+ d->shared = QSharedPointer<Private::Shared>::create();
+
+ KIS_SAFE_ASSERT_RECOVER_RETURN(
(!colorants.isEmpty() || colorPrimariesType != PRIMARIES_UNSPECIFIED)
&& transferFunction != TRC_UNSPECIFIED);
@@ -144,7 +146,7 @@ IccColorProfile::IccColorProfile(const QVector<double> &colorants,
iccProfile = cmsCreateRGBProfile(&whitePoint, &primaries, curve);
}
- KIS_ASSERT(iccProfile);
+ KIS_SAFE_ASSERT_RECOVER_RETURN(iccProfile);
QStringList name;
name.append("Krita");
@@ -167,8 +169,6 @@ IccColorProfile::IccColorProfile(const QVector<double> &colorants,
setCharacteristics(colorPrimariesType, transferFunction);
- d->shared = QSharedPointer<Private::Shared>::create();
-
setRawData(LcmsColorProfileContainer::lcmsProfileToByteArray(iccProfile));
cmsCloseProfile(iccProfile);
setFileName(name.join(" ").split(" ").join("-")+".icc");