Skip to content

Commit

Permalink
Remove "expect" from fallible code
Browse files Browse the repository at this point in the history
    code would crash if handling pointer capture outside of winit on
    every mouse click

    we swallow the error since we could not think of a case where this
    would fail in a way that would want to handle that it fails
  • Loading branch information
TotalKrill committed Nov 25, 2021
1 parent 265a8f1 commit bc9314f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/platform_impl/web/web_sys/canvas/pointer_handler.rs
Expand Up @@ -79,9 +79,11 @@ impl PointerHandler {
event::mouse_button(&event),
event::mouse_modifiers(&event),
);
canvas
.set_pointer_capture(event.pointer_id())
.expect("Failed to set pointer capture");

// Error is swallowed here since the error would occur every time the mouse is
// clicked when the cursor is grabbed, and there is probably not a situation where
// this could fail, that we care if it fails.
let _e = canvas.set_pointer_capture(event.pointer_id());
},
));
}
Expand Down

0 comments on commit bc9314f

Please sign in to comment.