fix(location): check for existence before using

Check to see if the value exists before attempting to use it

Partially fixes #4442