diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c index 66f02c08..3387dee4 100644 --- a/tools/tiffsplit.c +++ b/tools/tiffsplit.c @@ -1,4 +1,4 @@ -/* $Id: tiffsplit.c,v 1.9 2004-06-05 08:11:26 dron Exp $ */ +/* $Id: tiffsplit.c,v 1.10 2005-05-17 14:18:48 dron Exp $ */ /* * Copyright (c) 1992-1997 Sam Leffler @@ -151,10 +151,12 @@ tiffcp(TIFF* in, TIFF* out) CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); CopyField(TIFFTAG_COMPRESSION, compression); if (compression == COMPRESSION_JPEG) { - uint16 count; - void *table; - TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table); - TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table); + uint16 count = 0; + void *table = NULL; + if (TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table) + && count > 0 && table) { + TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table); + } } CopyField(TIFFTAG_PHOTOMETRIC, shortv); CopyField(TIFFTAG_PREDICTOR, shortv);