Skip to content

Commit 72c79f3

Browse files
committed
example-runner-wgpu: fix wasm build (winit 0.29 breaking changes).
1 parent 7358fae commit 72c79f3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/runners/wgpu/src/graphics.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,11 @@ pub fn start(
497497
use winit::platform::web::WindowExtWebSys;
498498
// On wasm, append the canvas to the document body
499499
web_sys::window()
500-
.and_then(|win| win.document())
501-
.and_then(|doc| doc.body())
502-
.and_then(|body| {
503-
body.append_child(&web_sys::Element::from(window.canvas()))
500+
.and_then(|dom_window| {
501+
dom_window
502+
.document()?
503+
.body()?
504+
.append_child(&web_sys::Element::from(window.canvas()?))
504505
.ok()
505506
})
506507
.expect("couldn't append canvas to document body");

0 commit comments

Comments
 (0)