Label.st
branchjv
changeset 5987 f9cc7367fde9
parent 5981 50c1bb3e9f98
parent 5983 1fe3da275b7f
child 6085 4ecbe3a93aec
--- a/Label.st	Thu Nov 24 21:56:11 2016 +0000
+++ b/Label.st	Sat Nov 26 22:23:03 2016 +0000
@@ -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).