0

This minimal example triggers V3125 about member being used after it was verified against null. If I remove the extra semicolon after the first return statement V3125 is no longer triggered.

public class PVS_nullcheck
{
    private object member;

    public int Method()
    {
        if (member == null)
        {
            return 0;
            ; // <-- 3125
        }

        return member.GetHashCode();
    }
}
Jonas Nyrup
  • 2,376
  • 18
  • 25

1 Answers1

0

Thank you for the feedback. We have fixed this false alarm, the fix will be available in the next release version of PVS-Studio. You can download the latest beta from here.

Ilya Ivanov
  • 123
  • 6