Skip to content

Commit a86e8a5

Browse files
committed
WPF - Throw exception if Load called before browser initialized
Follow up to #2260
1 parent c39e288 commit a86e8a5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,6 +2157,12 @@ private void OnMouseButton(MouseButtonEventArgs e)
21572157
/// <param name="url">The URL to be loaded.</param>
21582158
public void Load(string url)
21592159
{
2160+
if (!InternalIsBrowserInitialized())
2161+
{
2162+
throw new Exception("The browser has not been initialized. Load can only be called" +
2163+
"after the underlying CEF browser is initialized (CefLifeSpanHandler::OnAfterCreated).");
2164+
}
2165+
21602166
// Added null check -> binding-triggered changes of Address will lead to a nullref after Dispose has been called
21612167
// or before OnApplyTemplate has been called
21622168
if (browser != null)

0 commit comments

Comments
 (0)