diff --git a/IccProfLib/IccCmm.cpp b/IccProfLib/IccCmm.cpp index a43e98771..7be4a0a34 100644 --- a/IccProfLib/IccCmm.cpp +++ b/IccProfLib/IccCmm.cpp @@ -8309,6 +8309,11 @@ icStatusCMM CIccCmm::AddXform(CIccProfile *pProfile, nIntent = icPerceptual; } + // this must check before creating the Xform, because that can delete the profile + if (pProfile->m_Header.deviceClass == icSigMaterialVisualizationClass) { + bInput = true; + } + CIccXformPtr Xform; Xform.ptr = CIccXform::Create(pProfile, bInput, nIntent, nInterp, pPcc, nLutType, bUseD2BxB2DxTags, pHintManager); @@ -8317,10 +8322,6 @@ icStatusCMM CIccCmm::AddXform(CIccProfile *pProfile, return icCmmStatBadXform; } - if (pProfile->m_Header.deviceClass==icSigMaterialVisualizationClass) { - bInput = true; - } - m_nLastSpace = nDstSpace; m_nLastParentSpace = nParentSpace; m_nLastIntent = nIntent;