Label.st
changeset 5983 1fe3da275b7f
parent 5943 050b4d258e8d
child 5987 f9cc7367fde9
child 6052 c13ee730ce29
--- a/Label.st	Thu Nov 24 09:55:00 2016 +0100
+++ b/Label.st	Thu Nov 24 09:56:45 2016 +0100
@@ -1940,7 +1940,8 @@
     "redraw my label with fg/bg - this generic method is also used by subclasses
      (especially Button) to redraw the logo in different colors."
 
-    |x y scaleH scaleV nW nH hSep vSep m2 ascent currentTransformation|
+    |x y scaleH scaleV nW nH hSep vSep m2 ascent currentTransformation
+     logoWidth logoHeight|
 
     doClear ifTrue:[self clearInsideWith:bg].
 
@@ -1954,12 +1955,18 @@
         y := labelOriginY.
 
         logo isImageOrForm ifTrue:[
+            logoWidth := logo width.
+            logoHeight := logo height.
+            ((logoWidth == 0) or:[logoHeight == 0]) ifTrue:[
+                "/ do nothing; also avoids followup errors in the image creation and division by zero...
+                ^ self.
+            ].    
             adjust == #fit ifTrue:[
                 "/
                 "/ change scale to make the logo fit exactly
                 "/
-                scaleH := ((width - hSep) / (logo width)) asFloat.
-                scaleV := ((height - vSep) / (logo height)) asFloat.
+                scaleH := ((width - hSep) / logoWidth) asFloat.
+                scaleV := ((height - vSep) / logoHeight) asFloat.
                 scaleH <= 0 ifTrue:[scaleH := Float epsilon].
                 scaleV <= 0 ifTrue:[scaleV := Float epsilon].
                 self scale:(scaleH @ scaleV).