From c86752e39dd015aa66c741be3e2312c6f0e69ef1 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Tue, 10 Dec 2019 14:48:54 +0100 Subject: avoid crashing with empty build templates This would occur if e.g. only the profession was given. --- src/render.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/render.rs') 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 { let images = self.construct_parts(build)?; + if images.is_empty() { + return Err(RenderError::EmptyBuild); + } self.merge_parts(&images) } -- cgit v1.2.3