From 4dabde04853d8eb3924750f0c1c1841b6119d81d Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 8 Mar 2024 08:26:03 +0100 Subject: [PATCH] Add assertion for decreasing the indent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> (cherry picked from commit a27651908fc1b5ef73a81e46434a408c5868fa7b) Change-Id: I2ec78e234c1c6e982f7b05f81d8b8356daf6c274 --- src/libexpr/print.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libexpr/print.cc b/src/libexpr/print.cc index 53d0861bf..76f9a9c56 100644 --- a/src/libexpr/print.cc +++ b/src/libexpr/print.cc @@ -174,6 +174,7 @@ private: void decreaseIndent() { if (options.prettyPrint()) { + assert(indent.size() >= options.prettyIndent); indent.resize(indent.size() - options.prettyIndent); } }