Explorar o código

* fix for mantis #13171, a default for gettextheight so that it doesn't
totally fall apart if no canvas is assigned.

git-svn-id: trunk@14950 -

marco %!s(int64=15) %!d(string=hai) anos
pai
achega
e001876e2b
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      packages/fcl-image/src/fpfont.inc

+ 4 - 1
packages/fcl-image/src/fpfont.inc

@@ -54,7 +54,10 @@ begin
   if inheritsFrom (TFPCustomDrawFont) then
     result := TFPCustomDrawFont(self).DoGetTextHeight (text)
   else
-    result := FCanvas.GetTextHeight (text);
+   if assigned(FCanvas) then
+     result := FCanvas.GetTextHeight (text)
+   else 
+     result :=16; // *some* default better than none.
 end;
 
 function TFPCustomFont.GetTextWidth (text:string) : integer;