Skip non parsable resolutions instead of crashing

This commit is contained in:
2018-11-01 08:32:01 +01:00
parent 9e40498be6
commit 06414b2e51
+9 -4
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]);
}
}