summaryrefslogtreecommitdiff
path: root/packages/fcl-image
diff options
context:
space:
mode:
authorsekelsenmat <sekelsenmat@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-11-06 17:00:52 +0000
committersekelsenmat <sekelsenmat@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-11-06 17:00:52 +0000
commit6f0b4126453951dfcb9a2021d91742a8b26455b1 (patch)
tree1350f536f3b574edc377b73534d4e2557d70baf9 /packages/fcl-image
parente1b0a6285bdbb7d7d47c4537d7f7ff87ad6c4709 (diff)
downloadfpc-6f0b4126453951dfcb9a2021d91742a8b26455b1.tar.gz
Fixes a list out of bounds exception in freetype
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16308 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-image')
-rw-r--r--packages/fcl-image/src/freetype.pp12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/fcl-image/src/freetype.pp b/packages/fcl-image/src/freetype.pp
index f05b66bce6..92ba87605e 100644
--- a/packages/fcl-image/src/freetype.pp
+++ b/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);