ImageEditView.st
changeset 4714 69df9f744066
parent 4646 b1faa362e0ac
child 4715 c851a10dd606
--- a/ImageEditView.st	Sat Feb 21 13:11:21 2015 +0100
+++ b/ImageEditView.st	Sun Feb 22 11:25:33 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libwidg2' }"
 
+"{ NameSpace: Smalltalk }"
+
 ImageView subclass:#ImageEditView
 	instanceVariableNames:'readOnly magnification imageReaderClass resourceClass
 		resourceSelector mouseKeyColorMode undoImages modifiedHolder
@@ -2602,18 +2604,20 @@
             (self confirm:(ex errorString,'\\Debug?' withCRs)) ifTrue:[ ex reject ].
             ^ false                                 
         ] do: [   
-            |img depth bestDepth numColorsUsed category imageStoreStream sel mthd imageKey|
+            |img depth bestDepth colorsUsed numColorsUsed category imageStoreStream sel mthd imageKey|
 
             img := self image.
-            depth := img depth.
-            numColorsUsed := (img usedColorsMax:256) size.
-            bestDepth := image depth.
-            #(8 4 2 1) do:[:d |
-                depth > d ifTrue:[
-                    numColorsUsed <= (1 << d) ifTrue:[
-                        bestDepth := d
+            depth := bestDepth := img depth.
+            colorsUsed := (img usedColorsMax:256).
+            colorsUsed notNil ifTrue:[
+                numColorsUsed := colorsUsed size.
+                #(8 4 2 1) do:[:d |
+                    depth > d ifTrue:[
+                        numColorsUsed <= (1 << d) ifTrue:[
+                            bestDepth := d
+                        ]
                     ]
-                ]
+                ].
             ].
             bestDepth < depth ifTrue:[
                 (Dialog 
@@ -2794,11 +2798,11 @@
 !ImageEditView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.262 2014-07-08 21:22:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.263 2015-02-22 10:25:33 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.262 2014-07-08 21:22:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.263 2015-02-22 10:25:33 cg Exp $'
 ! !