Skip to content

Commit 59904d8

Browse files
committed
[NFC] Fix potential underflow constant.
1 parent 22fdc57 commit 59904d8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang-tools-extra/clang-tidy/bugprone/CrtpConstructorAccessibilityCheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ getDerivedParameter(const ClassTemplateSpecializationDecl *CRTP,
5858
Arg.getAsType()->getAsCXXRecordDecl() == Derived;
5959
});
6060

61-
return AnyOf ? CRTP->getSpecializedTemplate()
62-
->getTemplateParameters()
63-
->getParam(Idx - 1)
64-
: nullptr;
61+
return AnyOf && Idx > 0 ? CRTP->getSpecializedTemplate()
62+
->getTemplateParameters()
63+
->getParam(Idx - 1)
64+
: nullptr;
6565
}
6666

6767
static std::vector<FixItHint>

0 commit comments

Comments
 (0)