1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00

windows: avoid panic on startup

In 30b262c1c0 I introduced an unwrap
here.  On Windows, this code can be called before we've set up opengl.
Allow for that!
This commit is contained in:
Wez Furlong 2021-01-17 10:24:58 -08:00
parent fa4bbbd077
commit 957ad6af90

View File

@ -2245,28 +2245,25 @@ impl TermWindow {
(size, *dimensions)
};
if let Err(err) = self
.render_state
.as_mut()
.unwrap()
.advise_of_window_size_change(
if let Some(render_state) = self.render_state.as_mut() {
if let Err(err) = render_state.advise_of_window_size_change(
&self.render_metrics,
dimensions.pixel_width,
dimensions.pixel_height,
)
{
log::error!(
"failed to advise of resize from {:?} -> {:?}: {:?}",
orig_dimensions,
dimensions,
err
);
// Try to restore the original dimensions
self.dimensions = orig_dimensions;
// Avoid the inner resize below
scale_changed_cells.take();
} else {
self.terminal_size = size;
) {
log::error!(
"failed to advise of resize from {:?} -> {:?}: {:?}",
orig_dimensions,
dimensions,
err
);
// Try to restore the original dimensions
self.dimensions = orig_dimensions;
// Avoid the inner resize below
scale_changed_cells.take();
} else {
self.terminal_size = size;
}
}
let mux = Mux::get().unwrap();