Fix null ptr access.