Handle missing references

master
Tom Alexander 4 years ago
parent fe32edbc28
commit 24d2c1831c
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -87,8 +87,13 @@ impl<'a> DustRenderer<'a> {
match tag {
DustTag::DTComment(_comment) => (),
DustTag::DTReference(reference) => {
let val = walk_path(context, &reference.path.keys)?;
return val.render();
let val = walk_path(context, &reference.path.keys);
if let Err(RenderError::WontWalk { .. }) = val {
// If reference does not exist in the context, it becomes an empty string
return Ok("".to_owned());
} else {
return val?.render();
}
}
_ => (), // TODO: Implement the rest
}

Loading…
Cancel
Save