This should probably check for the ResourceHandle instead of the FileDescriptor if it crashed when trying to read the string in that, no?

This commit is contained in:
Ottermandias 2021-07-11 12:02:22 +02:00
parent ae62f0666d
commit e41dedf9dd

View file

@ -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;
}