about summary refs log tree commit diff
path: root/converter/other/rasttopnm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-16 16:50:44 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-16 16:50:44 +0000
commit68f8361a5914cb47162cc73819f7ca75297c5ad4 (patch)
tree538cc421184006037cc0bf5a7294910fa58be466 /converter/other/rasttopnm.c
parent212db41f437227f37f8f259999edcb534b07aa2e (diff)
downloadnetpbm-mirror-68f8361a5914cb47162cc73819f7ca75297c5ad4.tar.gz
netpbm-mirror-68f8361a5914cb47162cc73819f7ca75297c5ad4.tar.xz
netpbm-mirror-68f8361a5914cb47162cc73819f7ca75297c5ad4.zip
Error message if -index with non-colormapped image
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1547 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/rasttopnm.c')
-rw-r--r--converter/other/rasttopnm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/converter/other/rasttopnm.c b/converter/other/rasttopnm.c
index 679e361b..ee8b8317 100644
--- a/converter/other/rasttopnm.c
+++ b/converter/other/rasttopnm.c
@@ -322,6 +322,10 @@ main(int argc, const char ** const argv) {
     if (pr == NULL )
         pm_error("unable to read in the image from the rasterfile" );
 
+    if (cmdline.index && header.ras_maplength == 0)
+        pm_error("You requested to use color map indices as colors (-index), "
+                 "but this is not a color mapped image");
+
     writePnm(stdout, pr, header.ras_width, header.ras_height, maxval, format,
              header.ras_depth, header.ras_type, grayscale, 
              header.ras_maplength > 0, colorMap, zero, one, cmdline.index);