Skip to content

Commit 4f0c342

Browse files
committed
[clang-tidy] Fix bugprone-unchecked-optional-access in TimeSubtractionCheck
1 parent f6677ba commit 4f0c342

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang-tools-extra/clang-tidy/abseil/TimeSubtractionCheck.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ void TimeSubtractionCheck::registerMatchers(MatchFinder *Finder) {
9696
const std::string TimeInverse = (llvm::Twine("ToUnix") + ScaleName).str();
9797
std::optional<DurationScale> Scale = getScaleForTimeInverse(TimeInverse);
9898
assert(Scale && "Unknown scale encountered");
99+
if (!Scale)
100+
continue;
99101

100102
auto TimeInverseMatcher = callExpr(callee(
101103
functionDecl(hasName((llvm::Twine("::absl::") + TimeInverse).str()))

0 commit comments

Comments
 (0)