From 3dd8b659ef0d3573e006bdf6ee3e7bd42687bbee Mon Sep 17 00:00:00 2001 From: will wade Date: Thu, 18 Jun 2026 07:51:15 +0100 Subject: [PATCH] Add null guard in CreateInputFilter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If Realize() partially fails (e.g. ChangeAlphabet throws and the exception is caught by an outer handler), CreateModules() may never have run, leaving the module registry empty. When SetStringParameter is then called for SP_INPUT_FILTER (e.g. the CAPI forces 'Normal Control' after Realize), CreateInputFilter dereferences a null pointer and crashes. Add an explicit null check after both lookup attempts — if no input filter module is found, return early rather than crashing. Signed-off-by: will wade --- src/DasherCore/DasherInterfaceBase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DasherCore/DasherInterfaceBase.cpp b/src/DasherCore/DasherInterfaceBase.cpp index a5fadf61..08222cb4 100644 --- a/src/DasherCore/DasherInterfaceBase.cpp +++ b/src/DasherCore/DasherInterfaceBase.cpp @@ -655,6 +655,8 @@ void CDasherInterfaceBase::CreateInputFilter() { if (m_pInputFilter == nullptr) m_pInputFilter = m_pModuleManager->GetDefaultInputMethod(); + if (m_pInputFilter == nullptr) return; // Modules not yet registered + m_pInputFilter->Activate(); }