Watch out for a null pointer in location provider.

Fixed #208.