fix: avoid panic when no outputs are present
Replace `unwrap()` on the output scale query with conditional handling. This prevents a panic when the last output is removed and the query temporarily returns no results + add test to cover removing all outputs.
This commit is contained in:
parent
ecde06ed3a
commit
10f985b84c
2 changed files with 26 additions and 15 deletions
|
|
@ -1773,6 +1773,17 @@ fn output_offset_remove_output() {
|
|||
check_output_position_event(&output_main_c, (0, 0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_all_outputs() {
|
||||
let (mut f, _) = TestFixture::new_with_compositor();
|
||||
|
||||
let (_, output) = f.new_output(0, 0);
|
||||
f.run();
|
||||
|
||||
f.remove_output(output);
|
||||
f.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_offset_surface_positioning() {
|
||||
let (mut f, comp) = TestFixture::new_with_compositor();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue