If you use
if (x == null)
you will not get a NullPointerException
.
I suspect you're doing:
if (x.y == null)
which is throwing because x
is null, not because x.y
is null.
If that doesn't explain it, please post the code you're using to test for nullity.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…