* fixed crash when trying to load an image type fpimage doesn't support

git-svn-id: trunk@17849 -
This commit is contained in:
andrew 2008-12-16 04:50:15 +00:00
parent 332993241d
commit e059ec103f

View File

@ -139,16 +139,18 @@ begin
FileExt := ExtractFileExt(URL); FileExt := ExtractFileExt(URL);
Picture := TPicture.Create; Picture := TPicture.Create;
Stream := fChm.GetObject('/'+URL);
try try
Stream := fChm.GetObject('/'+URL); if Assigned(Stream) then
if Assigned(Stream) then
begin begin
Stream.Position := 0; Stream.Position := 0;
Picture.LoadFromStreamWithFileExt(Stream, FileExt); Picture.LoadFromStreamWithFileExt(Stream, FileExt);
end; end;
finally except
Stream.Free; // only happens if it's an image type we can't handle
end; end;
if Stream <> nil then
Stream.Free;
end; end;
function TIpChmDataProvider.CanHandle(const URL: string): Boolean; function TIpChmDataProvider.CanHandle(const URL: string): Boolean;