fix an bug:
sometimes may crash maybe caused by the null location,so i do some
fix ,and it may now well.