diff --git a/location.module b/location.module index a24d026..0a2961a 100644 --- a/location.module +++ b/location.module @@ -878,7 +878,7 @@ function location_load_location($lid) { $location = db_fetch_array(db_query('SELECT * FROM {location} WHERE lid = %d', $lid)); // @@@ Just thought of this, but I am not certain it is a good idea... if (empty($location)) { - $location = array('lid' => $lid); + $location = FALSE; } if (isset($location['source']) && $location['source'] == LOCATION_LATLON_USER_SUBMITTED) { // Set up location chooser or lat/lon fields from the stored location. @@ -1084,7 +1084,12 @@ function location_save(&$location, $cow = TRUE, $criteria = array()) { } // Pull in fields that hold data currently not editable directly by the user. - $location = array_merge($oldloc, $location); + if (isset($oldloc['lid'])) { + $location = array_merge($oldloc, $location); + } else { + // the old location does not exist - we can't re-use it + unset($location['lid']); + } // Note: If the user clears all the fields, the location can still // be non-empty if the user didn't have access to everything..