Skip to content

Commit

Permalink
Finalize gracefully when constructor throws
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnsm committed Mar 3, 2024
1 parent 96847f5 commit ffec795
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Millistream.Streaming/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ internal IntPtr Handle
/// <remarks>The corresponding native function is mdf_message_destroy.</remarks>
public void Dispose()
{
_nativeImplementation.mdf_message_destroy(_handle);
_nativeImplementation?.mdf_message_destroy(_handle);
_handle = default;
GC.SuppressFinalize(this);
}
Expand Down

0 comments on commit ffec795

Please sign in to comment.