--- a/ImageEditor.st Thu Nov 05 21:14:35 2009 +0100
+++ b/ImageEditor.st Thu Nov 05 22:56:54 2009 +0100
@@ -4702,14 +4702,15 @@
oldToNew := ByteArray new:(1 bitShift:depth).
newColorMap := usedColors asArray.
newColorMap sort:self sortBlockForColors.
-
- oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr |
- |newPixel|
-
- (usedColors includes:clr) ifTrue:[
- newPixel := newColorMap indexOf:clr.
- oldToNew at:oldIdx put:newPixel-1.
- ]
+ oldImage colorMap notNil ifTrue:[
+ oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr |
+ |newPixel|
+
+ (usedColors includes:clr) ifTrue:[
+ newPixel := newColorMap indexOf:clr.
+ oldToNew at:oldIdx put:newPixel-1.
+ ]
+ ].
].
oldBits := oldImage bits.