Commit c4573e35 authored by Martin Finkel's avatar Martin Finkel

Handle setting Media to null on the MediaPlayer

parent f928d037
......@@ -673,6 +673,7 @@ namespace LibVLCSharp.Shared
/// Get the media used by the media_player.
/// Set the media that will be used by the media_player.
/// If any, previous md will be released.
/// Note: It is safe to release the Media on the C# side after it's been set on the MediaPlayer successfully
/// </summary>
public Media Media
......@@ -681,7 +682,7 @@ namespace LibVLCSharp.Shared
var mediaPtr = Native.LibVLCMediaPlayerGetMedia(NativeReference);
return mediaPtr == IntPtr.Zero ? null : new Media(mediaPtr);
set => Native.LibVLCMediaPlayerSetMedia(NativeReference, value.NativeReference);
set => Native.LibVLCMediaPlayerSetMedia(NativeReference, value?.NativeReference ?? IntPtr.Zero);
/// <summary>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment