From d7badc8402876ca666236955c0012efae002e3e8 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Thu, 14 May 2009 11:19:28 +0000 Subject: [PATCH] Fixed precondition failed message which was trying to dereference nil. --- app/models/relation.rb | 3 +-- test/functional/relation_controller_test.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/relation.rb b/app/models/relation.rb index 95181ef05..2619a545a 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -307,8 +307,7 @@ class Relation < ActiveRecord::Base # and check that it is OK to use. 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}") - return false + raise OSM::APIPreconditionFailedError.new("Relation with id #{self.id} cannot be saved due to #{m[0]} with id #{m[1]}") end hash[m[1]] = true end diff --git a/test/functional/relation_controller_test.rb b/test/functional/relation_controller_test.rb index e51db0b75..bb562b24b 100644 --- a/test/functional/relation_controller_test.rb +++ b/test/functional/relation_controller_test.rb @@ -341,7 +341,7 @@ class RelationControllerTest < ActionController::TestCase # expect failure assert_response :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 # ------------------------------------- -- 2.43.2