summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2011-09-01 16:48:31 +0200
committerAlbert Astals Cid <aacid@kde.org>2011-09-01 16:48:31 +0200
commit0722960b4cf4ce40b6bd278ac7287d64a1d70bf2 (patch)
treef69ba6e6c4ce3f0d17de226176ba85c30c01333a /utils
parentf848edab849910b8291c7974e484ef5d02b2234c (diff)
xpdf303: Do not crash if imgStr->getLine() is NULL
Diffstat (limited to 'utils')
-rw-r--r--utils/ImageOutputDev.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index 6ca5ef46..b35869f3 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -230,13 +230,20 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
for (y = 0; y < height; ++y) {
// write the line
- p = imgStr->getLine();
- for (x = 0; x < width; ++x) {
- colorMap->getRGB(p, &rgb);
- fputc(colToByte(rgb.r), f);
- fputc(colToByte(rgb.g), f);
- fputc(colToByte(rgb.b), f);
- p += colorMap->getNumPixelComps();
+ if ((p = imgStr->getLine())) {
+ for (x = 0; x < width; ++x) {
+ colorMap->getRGB(p, &rgb);
+ fputc(colToByte(rgb.r), f);
+ fputc(colToByte(rgb.g), f);
+ fputc(colToByte(rgb.b), f);
+ p += colorMap->getNumPixelComps();
+ }
+ } else {
+ for (x = 0; x < width; ++x) {
+ fputc(0, f);
+ fputc(0, f);
+ fputc(0, f);
+ }
}
}
imgStr->close();