aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/base/UCovers.pas21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/base/UCovers.pas b/src/base/UCovers.pas
index 6c7c9e48..7f378c40 100644
--- a/src/base/UCovers.pas
+++ b/src/base/UCovers.pas
@@ -154,7 +154,12 @@ begin
end;
function TCover.GetTexture(): TTexture;
+var
+ debughelper: UTF8String;
begin
+ if not (Assigned(Filename)) or (Filename = nil) then
+ Exit;
+ debughelper := Filename.ToUTF8(true);
Result := Texture.LoadTexture(Filename);
end;
@@ -268,10 +273,18 @@ begin
end;
function TCoverDatabase.FindCoverIntern(const Filename: IPath): int64;
+var
+ FileUTF8String: UTF8String;
begin
- Result := DB.GetTableValue('SELECT [ID] FROM ['+COVER_TBL+'] ' +
+ if Filename = nil then
+ Result := 0
+ else
+ begin
+ FileUTF8String:=Filename.ToUTF8;
+ Result := DB.GetTableValue('SELECT [ID] FROM ['+COVER_TBL+'] ' +
'WHERE [Filename] = ?',
- [Filename.ToUTF8]);
+ [FileUTF8String]);
+ end;
end;
function TCoverDatabase.FindCover(const Filename: IPath): TCover;
@@ -315,7 +328,7 @@ begin
FileDate := Now(); //FileDateToDateTime(FileAge(Filename));
Thumbnail := CreateThumbnail(Filename, Info);
- if (Thumbnail = nil) then
+ if not (assigned(Thumbnail)) or (Thumbnail = nil) then
Exit;
CoverData := TBlobWrapper.Create;
@@ -451,7 +464,7 @@ begin
// TODO: do not scale if image is smaller
ScaleImage(Thumbnail, MaxSize, MaxSize);
-
+
Result := Thumbnail;
end;