Refine previous fix a bit
Call GfxColorSpace::setupColorProfiles only when we really need it
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 7fcc3a2..6ac1874 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -2050,9 +2050,13 @@
if (hp == 0) {
error(errSyntaxWarning, -1, "read ICCBased color space profile error");
} else {
- GfxColorSpace::setupColorProfiles();
cmsHPROFILE dhp = (state != NULL && state->getDisplayProfile() != NULL) ? state->getDisplayProfile() : displayProfile;
- if (dhp == NULL) dhp = RGBProfile;
+ if (dhp == NULL) {
+ if (unlikely(RGBProfile == NULL)) {
+ GfxColorSpace::setupColorProfiles();
+ }
+ dhp = RGBProfile;
+ }
unsigned int cst = getCMSColorSpaceType(cmsGetColorSpace(hp));
unsigned int dNChannels = getCMSNChannels(cmsGetColorSpace(dhp));
unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(dhp));