From 805cc60039fcce2ba356430cb90811a6e300a540 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 22 Sep 2021 15:33:53 +0200 Subject: fix crash in compilerplugins/clang/unnecessaryoverride.cxx:328 Somehow the compountStmt doesn't have anything in the body? Happens in CurlSession.cxx but not sure where. Change-Id: I69bd2e694e22c891f34242b8bee28012e793f0c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122457 Reviewed-by: Noel Grandin Reviewed-by: Michael Stahl Tested-by: Jenkins --- compilerplugins/clang/unnecessaryoverride.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx index 7ce2627cc8fb..6523170105a2 100644 --- a/compilerplugins/clang/unnecessaryoverride.cxx +++ b/compilerplugins/clang/unnecessaryoverride.cxx @@ -325,6 +325,9 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl) } */ auto bodyIt = compoundStmt->body_begin(); + if (bodyIt == compoundStmt->body_end()) { + return true; + } auto declStmt = dyn_cast(*bodyIt); if (!declStmt || !declStmt->isSingleDecl()) return true; -- cgit