Fixed issue where we'd sometimes try to access a null pointer.