From 6a286b99cd27bd29f426056305ef535fedd03fe7 Mon Sep 17 00:00:00 2001 From: Noethix55555 <277300782+Noethix55555@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:53:00 -0400 Subject: [PATCH] fix: check MainHandle for null before starting MainEventLoop thread --- src/MpvNet/Player.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MpvNet/Player.cs b/src/MpvNet/Player.cs index 25310545..82568a40 100644 --- a/src/MpvNet/Player.cs +++ b/src/MpvNet/Player.cs @@ -73,6 +73,9 @@ public void Init(IntPtr formHandle, bool processCommandLine) MainHandle = mpv_create(); Handle = MainHandle; + if (MainHandle == IntPtr.Zero) + throw new Exception("error mpv_create"); + var events = Enum.GetValues().Cast(); foreach (mpv_event_id i in events) @@ -85,9 +88,6 @@ public void Init(IntPtr formHandle, bool processCommandLine) if (formHandle != IntPtr.Zero) TaskHelp.Run(MainEventLoop); - if (MainHandle == IntPtr.Zero) - throw new Exception("error mpv_create"); - if (App.IsTerminalAttached) { SetPropertyString("terminal", "yes");