diff --git a/CefSharp/Internals/RenderClientAdapterInternal.h b/CefSharp/Internals/RenderClientAdapterInternal.h index 4be5c5514..a343392a0 100644 --- a/CefSharp/Internals/RenderClientAdapterInternal.h +++ b/CefSharp/Internals/RenderClientAdapterInternal.h @@ -85,16 +85,17 @@ namespace CefSharp _renderWebBrowser->SetCursor((IntPtr) cursor); } - void WasResized() + CefRefPtr TryGetCefHost() { if (this->GetCefBrowser() == nullptr || this->GetCefBrowser()->GetHost() == nullptr) { - return; + return nullptr; + } + else + { + return this->GetCefBrowser()->GetHost(); } - - this->GetCefBrowser()->GetHost()->WasResized(); - } private: diff --git a/CefSharp/RenderClientAdapter.h b/CefSharp/RenderClientAdapter.h index e3dddbd95..0a882597d 100644 --- a/CefSharp/RenderClientAdapter.h +++ b/CefSharp/RenderClientAdapter.h @@ -42,7 +42,12 @@ namespace CefSharp void WasResized() { - _renderClientAdapterInternal->WasResized(); + auto cefHost = _renderClientAdapterInternal->TryGetCefHost(); + + if (cefHost != nullptr) + { + cefHost->WasResized(); + } } }; }