]> git.openstreetmap.org Git - rails.git/commitdiff
Fixed precondition failed message which was trying to dereference nil.
authorMatt Amos <zerebubuth@gmail.com>
Thu, 14 May 2009 11:19:28 +0000 (11:19 +0000)
committerMatt Amos <zerebubuth@gmail.com>
Thu, 14 May 2009 11:19:28 +0000 (11:19 +0000)
app/models/relation.rb
test/functional/relation_controller_test.rb

index 95181ef053b657d93893e20e94d2c4026b842512..2619a545a31f647b4727a8d14867d9063972b4b4 100644 (file)
@@ -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
index e51db0b756b23e30f64a4ad611496e28b43316a9..bb562b24b96c089774d6459dae879505a1a96eb9 100644 (file)
@@ -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
 
   # -------------------------------------