diff options
author | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2016-01-01 21:27:10 +0000 |
---|---|---|
committer | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2016-01-01 21:27:10 +0000 |
commit | f9ba3b70263b06b3dd430e2430db4b5faea8b894 (patch) | |
tree | 8241afa04f51c18e16f8775afd5221582e9b6cf9 /src | |
parent | 6b6c46c490fa3391139fbecc4776514bf040cf6d (diff) | |
download | usdx-f9ba3b70263b06b3dd430e2430db4b5faea8b894.tar.gz usdx-f9ba3b70263b06b3dd430e2430db4b5faea8b894.tar.xz usdx-f9ba3b70263b06b3dd430e2430db4b5faea8b894.zip |
Add checking of files
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3157 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | src/base/UCovers.pas | 21 |
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; |