Add missing null checks [ci skip]