]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Handle the case where no ImageWriter is returned. Avoids an NPE.
authorJeremias Maerki <jeremias@apache.org>
Wed, 8 Nov 2006 14:57:00 +0000 (14:57 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 8 Nov 2006 14:57:00 +0000 (14:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@472508 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/bitmap/PNGRenderer.java

index 82eb650236e21948fa5b0b41cf3ca7f53fdcaf64..19573e4d9c081521000ffb25d1b1050b837c8ec4 100644 (file)
@@ -141,6 +141,11 @@ public class PNGRenderer extends Java2DRenderer {
                 
                 // Encode PNG image
                 ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(getMimeType());
+                if (writer == null) {
+                    throw new IOException("Could not get an ImageWriter to produce " 
+                            + getMimeType() + ". The most likely explanation for this is a class"
+                            + " loading problem.");
+                }
                 log.debug("Writing image using " + writer.getClass().getName());
                 writer.writeImage(image, os, params);
             } finally {