Fixed crash while deleting null pointer