rivertile: properly validate -main-ratio flag

This commit is contained in:
Isaac Freund 2022-02-21 10:25:21 +01:00
parent d7d0c3cfb9
commit e67a9423a8
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -348,8 +348,12 @@ pub fn main() !void {
fatalPrintUsage("invalid value '{s}' provided to -main-count", .{raw});
}
if (result.argFlag("-main-ratio")) |raw| {
default_main_ratio = fmt.parseFloat(f64, raw) catch
default_main_ratio = fmt.parseFloat(f64, raw) catch {
fatalPrintUsage("invalid value '{s}' provided to -main-ratio", .{raw});
};
if (default_main_ratio < 0.1 or default_main_ratio > 0.9) {
fatalPrintUsage("invalid value '{s}' provided to -main-ratio", .{raw});
}
}
const display = wl.Display.connect(null) catch {