From 38c79a737ca01e2610c67e3b847da545b05f96b2 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 14 Oct 2017 09:27:01 +0200 Subject: Add panic to make sure indentation mismatches are detected --- askama_shared/src/generator.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'askama_shared/src/generator.rs') diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index 4588677..64fa1f5 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -765,6 +765,9 @@ impl<'a> Generator<'a> { } fn dedent(&mut self) { + if self.indent == 0 { + panic!("dedent() called while indentation == 0"); + } self.indent -= 1; } } -- cgit