fix(location): check for existence before using

Check to see if the value exists before attempting to use it to avoid throwing unnecessary errors

Partially fixes #4442