Files
codeql/csharp/ql/src/Bad Practices/CatchOfNullReferenceException.ql
2025-06-17 09:56:43 +02:00

20 lines
589 B
Plaintext

/**
* @name Poor error handling: catch of NullReferenceException
* @description Finds catch clauses that catch NullReferenceException
* @kind problem
* @problem.severity warning
* @precision very-high
* @id cs/catch-nullreferenceexception
* @tags quality
* reliability
* correctness
* error-handling
* external/cwe/cwe-395
*/
import csharp
from SpecificCatchClause scc
where scc.getCaughtExceptionType().hasFullyQualifiedName("System", "NullReferenceException")
select scc, "Poor error handling: try to fix the cause of the 'NullReferenceException'."