Pārlūkot izejas kodu

Fixes a list out of bounds exception in freetype

git-svn-id: trunk@16308 -
sekelsenmat 15 gadi atpakaļ
vecāks
revīzija
b87e3e5057
1 mainītis faili ar 9 papildinājumiem un 3 dzēšanām
  1. 9 3
      packages/fcl-image/src/freetype.pp

+ 9 - 3
packages/fcl-image/src/freetype.pp

@@ -433,11 +433,17 @@ end;
 
 function TFontManager.GetFont (FontID:integer) : TMgrFont;
 begin
-  result := TMgrFont(FList[FontID]);
-  if result <> CurFont then  // set last used size of the font as current size
+  if (FontID >= 0) and (FontID < FList.Count) then
+  begin
+    result := TMgrFont(FList[FontID]);
+
+    if result <> CurFont then  // set last used size of the font as current size
     begin
-    CurSize := result.LastSize;
+      CurSize := result.LastSize;
     end;
+  end
+  else
+    Result := nil;
 end;
 
 procedure TFontManager.GetSize (aSize, aResolution : integer);