better error report for too many colors
authorClaus Gittinger <cg@exept.de>
Wed, 26 Nov 2003 16:33:54 +0100
changeset 1858 3770543620e2
parent 1857 23ce428b6130
child 1859 ec5e2e788ae0
better error report for too many colors
XPMReader.st
--- a/XPMReader.st	Wed Nov 26 16:03:11 2003 +0100
+++ b/XPMReader.st	Wed Nov 26 16:33:54 2003 +0100
@@ -541,7 +541,14 @@
     |usedColors nColorsUsed nColors nChars map maskColorIndex
      isMasked imageMask|
 
-    usedColors := image usedColors asArray.
+    usedColors := image usedColorsMax:4096.
+    usedColors isNil ifTrue:[
+        ^ Image cannotRepresentImageSignal 
+            raiseWith:image
+            errorString:('XPMReader cannot represent this image (too many colors)').
+    ].
+
+    usedColors := usedColors asArray.
     nColors := nColorsUsed := usedColors size.
     (imageMask := image mask) notNil ifTrue:[
         nColors := nColors + 1.
@@ -624,7 +631,7 @@
 !XPMReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.58 2003-11-19 15:38:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.59 2003-11-26 15:33:54 cg Exp $'
 ! !
 
 XPMReader initialize!