]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_preference_controller.rb
Add exceptions for remaing cases where XML::Parser.string is used, to catch for empty...
[rails.git] / app / controllers / user_preference_controller.rb
index 68ea88eeac5922def89f7e7e947f73c68332e072..b07f4ecc5d0e287051522099a1dfb96a3ce9fac4 100644 (file)
@@ -52,7 +52,11 @@ class UserPreferenceController < ApplicationController
 
   # update the entire set of preferences
   def update
-    p = XML::Parser.string(request.raw_post)
+    do
+      p = XML::Parser.string(request.raw_post)
+    rescue LibXML::XML::Error, ArgumentError => ex
+      raise OSM::APIBadXMLError.new("preferences", xml, ex.message)
+    end
     doc = p.parse
 
     prefs = []