Simplified NPE checking logic