Hotfix for 0.93:
Avoid NPE when ICC Profile is present but can, for some reason, not be loaded.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_93@629714 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/fop/image/JpegImage.java b/src/java/org/apache/fop/image/JpegImage.java
index d67816c..8318d0d 100644
--- a/src/java/org/apache/fop/image/JpegImage.java
+++ b/src/java/org/apache/fop/image/JpegImage.java
@@ -24,6 +24,7 @@
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
+
 import org.apache.fop.util.CMYKColorSpace;
 
 /**
@@ -188,19 +189,19 @@
             }
             try {
                 iccProfile = ICC_Profile.getInstance(iccStream.toByteArray());
+                if (iccProfile.getNumComponents() != this.colorSpace.getNumComponents()) {
+                    log.warn("The number of components of the ICC profile ("
+                            + iccProfile.getNumComponents() 
+                            + ") doesn't match the image ("
+                            + this.colorSpace.getNumComponents()
+                            + "). Ignoring the ICC color profile.");
+                    this.iccProfile = null;
+                }
             } catch (IllegalArgumentException iae) {
                 log.warn("An ICC profile is present but it is invalid (" 
                         + iae.getMessage() + "). The color profile will be ignored. (" 
                         + this.getOriginalURI() + ")");
             }
-            if (iccProfile.getNumComponents() != this.colorSpace.getNumComponents()) {
-                log.warn("The number of components of the ICC profile ("
-                        + iccProfile.getNumComponents() 
-                        + ") doesn't match the image ("
-                        + this.colorSpace.getNumComponents()
-                        + "). Ignoring the ICC color profile.");
-                this.iccProfile = null;
-            }
         } else if (this.colorSpace == null) {
             log.error("ColorSpace not specified for JPEG image");
             return false;