CS.NRE.GEN.MIGHTAn object reference value from a local assignment of a null-constant, or from a call to a function that will return null, might be dereferenced either explicitly, or through a call to a function that will dereference it, without checking for null. Vulnerability and riskDereferencing a null object reference is a critical runtime problem that will crash the application on some operating systems and throw a runtime exception on others. Example 11 public class A { 2 public void foo() { 3 A c = null; 4 if (flag) 5 c.foo(); 6 } 7 8 private bool flag; 9 } Null-source: explicit assignmentNull-dereferencing: explicitKlocwork produces an issue report (CS.NRE.GEN.MIGHT) at line 5 for variable 'c'. If flag is greater than 0, 'c' will be dereferenced at line 6. |