aboutsummaryrefslogtreecommitdiff
path: root/src/render.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2019-12-10 14:48:54 +0100
committerDaniel Schadt <kingdread@gmx.de>2019-12-10 14:48:54 +0100
commitc86752e39dd015aa66c741be3e2312c6f0e69ef1 (patch)
tree893055684d534725fef986ea536569c1b8ccba24 /src/render.rs
parent0c9276482d1508480ca247183853a31b762d25cf (diff)
downloadkondou-c86752e39dd015aa66c741be3e2312c6f0e69ef1.tar.gz
kondou-c86752e39dd015aa66c741be3e2312c6f0e69ef1.tar.bz2
kondou-c86752e39dd015aa66c741be3e2312c6f0e69ef1.zip
avoid crashing with empty build templates
This would occur if e.g. only the profession was given.
Diffstat (limited to 'src/render.rs')
-rw-r--r--src/render.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/render.rs b/src/render.rs
index bb38399..90eff14 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -19,6 +19,9 @@ quick_error! {
cause(err)
from()
}
+ EmptyBuild {
+ description("The build template contains nothing worth rendering")
+ }
}
}
@@ -284,6 +287,9 @@ impl<'r> Renderer<'r> {
build: &BuildTemplate,
) -> Result<RgbaImage, RenderError> {
let images = self.construct_parts(build)?;
+ if images.is_empty() {
+ return Err(RenderError::EmptyBuild);
+ }
self.merge_parts(&images)
}