summaryrefslogtreecommitdiff
path: root/source/fitz/output-pnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/output-pnm.c')
-rw-r--r--source/fitz/output-pnm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/fitz/output-pnm.c b/source/fitz/output-pnm.c
index 3a605524..68f25bcb 100644
--- a/source/fitz/output-pnm.c
+++ b/source/fitz/output-pnm.c
@@ -39,6 +39,9 @@ pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
if (n-alpha != 1 && n-alpha != 3)
fz_throw(ctx, FZ_ERROR_GENERIC, "pixmap must be grayscale or rgb to write as pnm");
+ if (!out)
+ return;
+
if (end > h)
end = h;
end -= band_start;
@@ -78,6 +81,9 @@ pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
break;
}
case 3:
+ fz_write(ctx, out, p, num_written*3);
+ p += num_written*3;
+ break;
case 4:
{
char *o = buffer;
@@ -188,6 +194,9 @@ pam_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta
int y;
int end = band_start + band_height;
+ if (!out)
+ return;
+
if (end > h)
end = h;
end -= band_start;