Log warning instead of panicking on invalid color

fixes #498
This commit is contained in:
Henrik Friedrichsen
2021-04-26 22:01:02 +02:00
parent 7b162ceec9
commit 846a62e631

View File

@@ -10,8 +10,14 @@ macro_rules! load_color {
$theme
.as_ref()
.and_then(|t| t.$member.clone())
.map(|c| Color::parse(c.as_ref()).expect(&format!("Failed to parse color \"{}\"", c)))
.unwrap_or($default)
.and_then(|c| Color::parse(c.as_ref()))
.unwrap_or_else(|| {
warn!(
"Failed to parse color in \"{}\", falling back to default",
stringify!($member)
);
$default
})
};
}