Skip non parsable resolutions instead of crashing

This commit is contained in:
Thomas Forgione 2018-11-01 08:32:01 +01:00
parent 9e40498be6
commit 06414b2e51
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 9 additions and 4 deletions

View File

@ -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]);
}
}