--- src/cmsxform.c~	2009-03-26 17:53:27.000000000 +0000
+++ src/cmsxform.c	2009-03-26 18:31:41.000000000 +0000
@@ -689,6 +689,9 @@
                 GrayTRC = cmsReadICCGamma(hProfile, icSigGrayTRCTag);
                 FromLstarToXYZ(GrayTRC, Shapes1);

+		if (GrayTRC == NULL)
+			return NULL;
+
                 // Reversing must be done after curve translation

                 Shapes[0] = cmsReverseGamma(Shapes1[0]->nEntries, Shapes1[0]);
@@ -704,6 +707,9 @@

                 GrayTRC = cmsReadICCGammaReversed(hProfile, icSigGrayTRCTag);   // Y

+		if (GrayTRC == NULL)
+			return NULL;
+
                 Shapes[0] = cmsDupGamma(GrayTRC);
                 Shapes[1] = cmsDupGamma(GrayTRC);
                 Shapes[2] = cmsDupGamma(GrayTRC);
