Skip to content

Commit

Permalink
Avoid unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 13, 2023
1 parent 0dec08b commit 9418499
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,19 +1633,14 @@ mod glow_integration {

Ok(match event {
winit::event::Event::Resumed => {
if self.running.is_none() {
if let Some(running) = &mut self.running {
// not the first resume event. create whatever you need.
running.glutin_ctx.borrow_mut().on_resume(event_loop)?;
} else {
// first resume event.
// we can actually move this outside of event loop.
// and just run the on_resume fn of gl_window
self.init_run_state(event_loop)?;
} else {
// not the first resume event. create whatever you need.
self.running
.as_mut()
.unwrap()
.glutin_ctx
.borrow_mut()
.on_resume(event_loop)?;
}
EventResult::RepaintNow(
self.running
Expand Down

0 comments on commit 9418499

Please sign in to comment.