1 diff --git a/third_party/lcms/src/cmsgamma.c b/third_party/lcms/src/cmsgamma.c 2 index edb8f6bba..eb3dd881c 100644 3 --- a/third_party/lcms/src/cmsgamma.c 4 +++ b/third_party/lcms/src/cmsgamma.c 5 @@ -799,7 +799,7 @@ void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]) 6 // Duplicate a gamma table 7 cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* In) 8 { 9 - if (In == NULL) return NULL; 10 + if (In == NULL || In ->Segments == NULL || In ->Table16 == NULL) return NULL; 11 12 return AllocateToneCurveStruct(In ->InterpParams ->ContextID, In ->nEntries, In ->nSegments, In ->Segments, In ->Table16); 13 } 14