Fixed precondition failed message which was trying to dereference nil.

This commit is contained in:
Matt Amos 2009-05-14 11:19:28 +00:00
parent add2d223a6
commit d7badc8402
2 changed files with 2 additions and 3 deletions

View file

@ -307,8 +307,7 @@ class Relation < ActiveRecord::Base
# and check that it is OK to use. # and check that it is OK to use.
unless element and element.visible? and element.preconditions_ok? unless element and element.visible? and element.preconditions_ok?
raise OSM::APIPreconditionFailedError.new("Relation with id #{self.id} cannot be saved due to #{m[0]} with id #{element.id}") raise OSM::APIPreconditionFailedError.new("Relation with id #{self.id} cannot be saved due to #{m[0]} with id #{m[1]}")
return false
end end
hash[m[1]] = true hash[m[1]] = true
end end

View file

@ -341,7 +341,7 @@ class RelationControllerTest < ActionController::TestCase
# expect failure # expect failure
assert_response :precondition_failed, assert_response :precondition_failed,
"relation upload with invalid node did not return 'precondition failed'" "relation upload with invalid node did not return 'precondition failed'"
assert_equal "Precondition failed: Cannot create relation: data or member data is invalid.", @response.body assert_equal "Precondition failed: Relation with id cannot be saved due to Node with id 0", @response.body
end end
# ------------------------------------- # -------------------------------------