Fix possible 0 pointer access