From 7e3a6fb4a484fdda77fd5903b0f8131208c088b5 Mon Sep 17 00:00:00 2001 From: David Craven Date: Mon, 24 Oct 2022 04:40:41 +0200 Subject: [PATCH] Some fixes for wayland and ios. (#602) --- packages/desktop/Cargo.toml | 2 +- packages/desktop/src/desktop_context.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index 2e807283e..232b38ffb 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -28,7 +28,7 @@ tokio = { version = "1.16.1", features = [ "rt", "time", ], optional = true, default-features = false } -webbrowser = "0.7.1" +webbrowser = "0.8.0" infer = "0.9.0" dunce = "1.0.2" diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs index 89d0e2fe4..bf3a253c5 100644 --- a/packages/desktop/src/desktop_context.rs +++ b/packages/desktop/src/desktop_context.rs @@ -173,7 +173,13 @@ pub(super) fn handler( ) { // currently dioxus-desktop supports a single window only, // so we can grab the only webview from the map; - let webview = desktop.webviews.values().next().unwrap(); + // on wayland it is possible that a user event is emitted + // before the webview is initialized. ignore the event. + let webview = if let Some(webview) = desktop.webviews.values().next() { + webview + } else { + return; + }; let window = webview.window(); match user_event {