Skip to content

Commit ff22bd5

Browse files
Johny404Jan Vícha
and
Jan Vícha
authored
Added null checks for Destructor call when exception occured during constructor (#156)
Co-authored-by: Jan Vícha <[email protected]>
1 parent fa22d01 commit ff22bd5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

BTDB/StreamLayer/MemoryMappedMemReader.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ public bool Eof(ref MemReader memReader)
8282

8383
public void Dispose()
8484
{
85-
_viewAccessor.SafeMemoryMappedViewHandle.ReleasePointer();
86-
_memoryMappedFile.Dispose();
87-
_fileHandle.Dispose();
85+
_viewAccessor?.SafeMemoryMappedViewHandle.ReleasePointer();
86+
_memoryMappedFile?.Dispose();
87+
_fileHandle?.Dispose();
8888
GC.SuppressFinalize(this);
8989
}
9090

0 commit comments

Comments
 (0)