Fixed crash

Fixed crash bug with hasLocation check