Initialised pointer and corrected null check