From e41dedf9dd78cda13b668b93210216f6f4fcf29c Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sun, 11 Jul 2021 12:02:22 +0200 Subject: [PATCH] This should probably check for the ResourceHandle instead of the FileDescriptor if it crashed when trying to read the string in that, no? --- Penumbra/Interop/ResourceLoader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Penumbra/Interop/ResourceLoader.cs b/Penumbra/Interop/ResourceLoader.cs index 539a2bef..58874219 100644 --- a/Penumbra/Interop/ResourceLoader.cs +++ b/Penumbra/Interop/ResourceLoader.cs @@ -196,7 +196,7 @@ namespace Penumbra.Interop private unsafe byte ReadSqpackHandler( IntPtr pFileHandler, SeFileDescriptor* pFileDesc, int priority, bool isSync ) { - if( ( IntPtr )pFileDesc == IntPtr.Zero || ( IntPtr )pFileDesc->FileDescriptor == IntPtr.Zero ) + if( ReadFile == null || pFileDesc == null || pFileDesc->ResourceHandle == null ) { return ReadSqpackHook?.OriginalFunction( pFileHandler, pFileDesc, priority, isSync ) ?? 0; } @@ -205,7 +205,7 @@ namespace Penumbra.Interop var isRooted = Path.IsPathRooted( gameFsPath ); - if( gameFsPath == null || gameFsPath.Length >= 260 || !isRooted || ReadFile == null ) + if( gameFsPath == null || gameFsPath.Length >= 260 || !isRooted ) { return ReadSqpackHook?.OriginalFunction( pFileHandler, pFileDesc, priority, isSync ) ?? 0; }