Optimized null check