chore: Code cleanup (#399)

- [X] Code cleanup
This commit is contained in:
Kamron Batman 2021-01-10 09:14:03 -08:00 • committed by GitHub
parent a6e1172f97
commit 764d303543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 93 additions and 265 deletions

View file

@ -343,7 +343,13 @@ namespace Server
fixed (StaticTile* pTiles = staTiles)
{
NativeReader.Read(DataStream.SafeFileHandle.DangerousGetHandle(), pTiles, length);
var ptr = DataStream.SafeFileHandle?.DangerousGetHandle();
if (ptr == null)
{
throw new Exception($"Cannot open {DataStream.Name}");
}
NativeReader.Read(ptr.Value, pTiles, length);
if (m_Lists == null)
{
m_Lists = new TileList[8][];
@ -422,7 +428,12 @@ namespace Server
fixed (LandTile* pTiles = tiles)
{
NativeReader.Read(m_MapStream.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
var ptr = m_MapStream.SafeFileHandle?.DangerousGetHandle();
if (ptr == null)
{
throw new Exception($"Cannot open {m_MapStream.Name}");
}
NativeReader.Read(ptr.Value, pTiles, 192);
}
return tiles;