Skip to content

Fix a crash introduced by 3d5e9ab by adding a nullptr check. #90301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

rniwa
Copy link
Contributor

@rniwa rniwa commented Apr 27, 2024

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Apr 27, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 27, 2024

@llvm/pr-subscribers-clang-static-analyzer-1

@llvm/pr-subscribers-clang

Author: Ryosuke Niwa (rniwa)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/90301.diff

1 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp (+1-1)
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
index 741f336761589f..96bae0de65a5b1 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
@@ -54,7 +54,7 @@ class UncountedCallArgsChecker
       bool shouldVisitImplicitCode() const { return false; }
 
       bool TraverseDecl(Decl *D) {
-        if (isa<ClassTemplateDecl>(D) && isRefType(safeGetName(D)))
+        if (D && isa<ClassTemplateDecl>(D) && isRefType(safeGetName(D)))
           return true;
         return RecursiveASTVisitor<LocalVisitor>::TraverseDecl(D);
       }

@rniwa rniwa requested a review from haoNoQ April 27, 2024 00:03
@steakhal
Copy link
Contributor

Hey, do you think a regression test would be valuable?

@rniwa
Copy link
Contributor Author

rniwa commented Apr 27, 2024

Hey, do you think a regression test would be valuable?

Oh, that's a very good point. Added one.

Copy link

github-actions bot commented Apr 28, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@rniwa
Copy link
Contributor Author

rniwa commented Apr 29, 2024

Thanks for the review!

@rniwa rniwa merged commit e441363 into llvm:main Apr 29, 2024
@rniwa rniwa deleted the fix-crash-after-avoid-warning-in-ref-refptr branch April 29, 2024 16:27
rniwa added a commit to rniwa/llvm-project that referenced this pull request Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:static analyzer clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants