diff --git a/common/windows/delphi/chromium/Keyman.UI.UframeCEFHost.pas b/common/windows/delphi/chromium/Keyman.UI.UframeCEFHost.pas index bffcd952d2a..19f84b40c34 100644 --- a/common/windows/delphi/chromium/Keyman.UI.UframeCEFHost.pas +++ b/common/windows/delphi/chromium/Keyman.UI.UframeCEFHost.pas @@ -303,7 +303,7 @@ function TframeCEFHost.GetDebugInfo: string; function TframeCEFHost.HasFocus: Boolean; begin AssertVclThread; - Result := cefwp.HandleAllocated and IsChild(cefwp.Handle, GetFocus); + Result := Assigned(cefwp) and cefwp.HandleAllocated and IsChild(cefwp.Handle, GetFocus); end; procedure TframeCEFHost.Handle_CEF_SHOW(var message: TMessage); @@ -574,7 +574,8 @@ procedure TframeCEFHost.cefClose(Sender: TObject; const browser: ICefBrowser; procedure TframeCEFHost.Handle_CEF_DESTROY(var Message: TMessage); begin AssertVclThread; - cefwp.DestroyChildWindow; + if Assigned(cefwp) then + cefwp.DestroyChildWindow; FreeAndNil(cefwp); end;