From ae8744493df0539742a360e9ed7f204b79dd5594 Mon Sep 17 00:00:00 2001 From: Nature Is Frequency Date: Wed, 7 Feb 2024 00:29:35 +0000 Subject: [PATCH] Fix for #42 Guard against null _plugin within PluginHost::setParentWindow Follow error convention in source code Tested arch: arm64 Confirm no longer crash --- host/plugin-host.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/host/plugin-host.cc b/host/plugin-host.cc index c954800..fb62e69 100644 --- a/host/plugin-host.cc +++ b/host/plugin-host.cc @@ -265,6 +265,12 @@ static clap_window makeClapWindow(WId window) { void PluginHost::setParentWindow(WId parentWindow) { checkForMainThread(); + if(!_plugin) + { + std::cerr << "called with a null clap_plugin pointer!" << std::endl; + return; + } + if (!_plugin->canUseGui()) return;