Skip to content

Commit

Permalink
fix crash on focusOut for unavailable IM
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Dec 28, 2024
1 parent ef7ca8b commit 191a54b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion macosfrontend/macosfrontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ std::string MacosFrontend::focusOut(ICUUID uuid) {
InputContextEvent event(ic, EventType::InputContextSwitchInputMethod);
auto engine = instance_->inputMethodEngine(ic);
auto entry = instance_->inputMethodEntry(ic);
engine->deactivate(*entry, event);
if (engine && entry) {
// Prevent crash for unavailable IM (addon not loaded).
engine->deactivate(*entry, event);
}
// At this stage panel is still shown. If removed, a following backspace
// will commit a BS character in VSCode.
ic->setDummyPreedit(false);
Expand Down

0 comments on commit 191a54b

Please sign in to comment.