From 31a07a7ae8f7401674303d08981ad242e10155a5 Mon Sep 17 00:00:00 2001 From: FAPG Date: Fri, 20 Dec 2024 11:03:42 +0100 Subject: [PATCH] Placing a guard for undefined behaviour that appears to trigger sanitizers. --- ApprovalTests/integrations/catch/Catch2Approvals.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApprovalTests/integrations/catch/Catch2Approvals.h b/ApprovalTests/integrations/catch/Catch2Approvals.h index 4dac11ad..491ab4d8 100644 --- a/ApprovalTests/integrations/catch/Catch2Approvals.h +++ b/ApprovalTests/integrations/catch/Catch2Approvals.h @@ -48,7 +48,10 @@ struct Catch2ApprovalListener : Catch::TestEventListenerBase virtual void sectionEnded(Catch::SectionStats const& /*sectionStats*/) override { - currentTest.sections.pop_back(); + if (!currentTest.sections.empty()) + { + currentTest.sections.pop_back(); + } } }; //}