summaryrefslogtreecommitdiffstats
path: root/compilerplugins
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-09-22 15:33:53 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-09-22 17:15:42 +0200
commit805cc60039fcce2ba356430cb90811a6e300a540 (patch)
tree057c86601f0a13aced38a1cb71250e2c272b2181 /compilerplugins
parentsvx: improve SdrObjEditView::DisposeUndoManager() (diff)
downloadcore-805cc60039fcce2ba356430cb90811a6e300a540.tar.gz
core-805cc60039fcce2ba356430cb90811a6e300a540.zip
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 <noel.grandin@collabora.co.uk> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unnecessaryoverride.cxx3
1 files changed, 3 insertions, 0 deletions
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<DeclStmt>(*bodyIt);
if (!declStmt || !declStmt->isSingleDecl())
return true;