From ce99d9122f093edd467b808d46833b68f7f9fa64 Mon Sep 17 00:00:00 2001 From: Sami FERHAH Date: Tue, 29 Oct 2024 19:46:24 +0100 Subject: [PATCH] fix System.NullReferenceException when disconnecting Handler (#87) --- HybridWebView/HybridWebView.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HybridWebView/HybridWebView.cs b/HybridWebView/HybridWebView.cs index 8e1d565..4ce00d0 100644 --- a/HybridWebView/HybridWebView.cs +++ b/HybridWebView/HybridWebView.cs @@ -62,6 +62,12 @@ protected override async void OnHandlerChanged() await InitializeHybridWebView(); + // HybridWebViewInitialized assumes Handler != null + if (Handler == null) + { + return; + } + HybridWebViewInitialized?.Invoke(this, new HybridWebViewInitializedEventArgs() { #if ANDROID || IOS || MACCATALYST || WINDOWS