summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UCore.pas7
-rw-r--r--vfs/UVFSCore.pas11
2 files changed, 12 insertions, 6 deletions
diff --git a/UCore.pas b/UCore.pas
index cc6929f..bf5c012 100644
--- a/UCore.pas
+++ b/UCore.pas
@@ -520,11 +520,16 @@ end;
function GetFileInfoSL(Engine: TPanelEngine; const APath: string): PDataItemSL;
var ItemSL: PDataItemSL;
+ DataItem: PDataItem;
begin
+ Result := nil;
+ DataItem := Engine.GetFileInfo(APath, False, True, nil);
+ if DataItem = nil then Exit; // Inaccessible file
+
ItemSL := malloc(sizeof(TDataItemSL));
memset(ItemSL, 0, sizeof(TDataItemSL));
// * TODO: report errors? same way as for FillDirFiles
- ItemSL^.DataItem := Engine.GetFileInfo(APath, False, True, nil);
+ ItemSL^.DataItem := DataItem;
ItemSL^.Stage1 := True;
ItemSL^.Level := 1;
Result := ItemSL;
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas
index 0ce7e1f..b39ad8e 100644
--- a/vfs/UVFSCore.pas
+++ b/vfs/UVFSCore.pas
@@ -523,12 +523,13 @@ begin
end;
try
P := FSourcePlugin.FVFSFileInfo(FGlobs, PChar(APath), FollowSymlinks, AddFullPath, Error);
- if P <> nil then
+ if P <> nil then begin
Result := GetDataItemFromVFSItem(P);
- if P^.FName <> nil then real_libc_free(P^.FName);
- if P^.FDisplayName <> nil then real_libc_free(P^.FDisplayName);
- if P^.sLinkTo <> nil then real_libc_free(P^.sLinkTo);
- real_libc_free(P);
+ if P^.FName <> nil then real_libc_free(P^.FName);
+ if P^.FDisplayName <> nil then real_libc_free(P^.FDisplayName);
+ if P^.sLinkTo <> nil then real_libc_free(P^.sLinkTo);
+ real_libc_free(P);
+ end;
except
on E: Exception do begin
DebugMsg(['^^VFS (EE): GetFileInfo: Exception: ', E.Message]);