tty: Guard against output disappearing immediately after connection
Browse files at this commit289ae3604d705cebc82cbcd23ee4534ded16d3afParent: 55fb8851 changed file +4 -1
- src/backend/tty.rs +4 -1
src/backend/tty.rsmodified+4 -1
| @@ -1061,7 +1061,10 @@ impl Tty { | ||
| 1061 | 1061 | if niri.monitors_active { |
| 1062 | 1062 | // Redraw the new monitor. |
| 1063 | 1063 | niri.event_loop.insert_idle(move |state| { |
| 1064 | - state.niri.queue_redraw(&output); | |
| 1064 | + // Guard against output disconnecting before the idle has a chance to run. | |
| 1065 | + if state.niri.output_state.contains_key(&output) { | |
| 1066 | + state.niri.queue_redraw(&output); | |
| 1067 | + } | |
| 1065 | 1068 | }); |
| 1066 | 1069 | } |
| 1067 | 1070 |