]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api_controller.rb
return a blank 0.4 osm xml doc when on data found
[rails.git] / app / controllers / api_controller.rb
index 8e4004dd15652aa3bb4f1dfa5c7cf83da2f5f5fe..f61c67d6e548c4ff438ad376aae820af4ef7768d 100644 (file)
@@ -155,7 +155,7 @@ class ApiController < ApplicationController
     end
 
     if node_ids.length == 0
-      render :text => '<osm></osm>'
+      render :text => "<osm version='0.4'></osm>"
       return
     end
 
@@ -197,7 +197,8 @@ class ApiController < ApplicationController
 
     end
 
-    segments_to_fetch = list_of_way_segments.uniq - segment_ids
+    # - [0] in case some thing links to segment 0 which doesn't exist. Shouldn't actually ever happen but it does. FIXME: file a ticket for this
+    segments_to_fetch = (list_of_way_segments.uniq - segment_ids) - [0]
 
     if segments_to_fetch.length > 0
       segments += Segment.find(segments_to_fetch)