Index: app/controllers/relation_controller.rb
===================================================================
--- app/controllers/relation_controller.rb	(revision 14589)
+++ app/controllers/relation_controller.rb	Mon Apr 20 15:32:34 CEST 2009
@@ -183,6 +183,11 @@
   end
 
   def relations_for_object(objtype)
+    unless Relation.exists?(params[:id])
+      render :nothing => true, :status => :not_found
+      return
+    end
+
     relationids = RelationMember.find(:all, :conditions => ['member_type=? and member_id=?', objtype, params[:id]]).collect { |ws| ws.id[0] }.uniq
 
     doc = OSM::API.new.get_xml_doc
Index: app/controllers/way_controller.rb
===================================================================
--- app/controllers/way_controller.rb	(revision 14589)
+++ app/controllers/way_controller.rb	Mon Apr 20 15:28:12 CEST 2009
@@ -133,6 +133,11 @@
   # :id parameter. note that this used to return deleted ways as well, but
   # this seemed not to be the expected behaviour, so it was removed.
   def ways_for_node
+    unless Node.exists?(params[:id])
+      render :nothing => true, :status => :not_found
+      return
+    end
+    
     wayids = WayNode.find(:all, 
                           :conditions => ['node_id = ?', params[:id]]
                           ).collect { |ws| ws.id[0] }.uniq
