Skip non parsable resolutions instead of crashing
This commit is contained in:
parent
9e40498be6
commit
06414b2e51
13
src/lib.rs
13
src/lib.rs
|
@ -179,10 +179,15 @@ impl MultiScreen {
|
|||
.split("_").collect::<Vec<_>>()[0]
|
||||
.split("x").collect::<Vec<_>>();
|
||||
|
||||
last.resolutions.push((
|
||||
resolution[0].parse::<u32>()?,
|
||||
resolution[1].parse::<u32>()?,
|
||||
));
|
||||
if let Ok(width) = resolution[0].parse::<u32>() {
|
||||
if let Ok(height) = resolution[1].parse::<u32>() {
|
||||
last.resolutions.push((width, height));
|
||||
} else {
|
||||
eprintln!("Warning: couldn't parse height: {}, skipping...", resolution[1]);
|
||||
}
|
||||
} else {
|
||||
eprintln!("Warning: couldn't parse width: {}, skipping...", resolution[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue