Browse Source

* 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 15 years ago
parent
commit
e001876e2b
1 changed files with 4 additions and 1 deletions
  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;