Change how we check for null pionters

This fixes a bug.