diff options
author | Jochen Topf <jochen@topf.org> | 2014-08-26 16:27:05 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-08-26 16:27:05 +0200 |
commit | af129af70f5a49bf3cee0d5278a3938f3533b458 (patch) | |
tree | 9794d082fb9ec01158f224bfbf2240753919a810 /web/lib | |
parent | da910ccb43b800bad80ef05b57ed8e943a1d68ee (diff) | |
download | taginfo-af129af70f5a49bf3cee0d5278a3938f3533b458.tar taginfo-af129af70f5a49bf3cee0d5278a3938f3533b458.tar.gz |
Fix problem with unknown filters.
This used to result in an "undefined method `[]' for nil:NilClass" when a
filter was used in the API call that the API didn't know about.
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/api/v4/keys.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/web/lib/api/v4/keys.rb b/web/lib/api/v4/keys.rb index 4cebc82..98d60c6 100644 --- a/web/lib/api/v4/keys.rb +++ b/web/lib/api/v4/keys.rb @@ -34,9 +34,9 @@ class Taginfo < Sinatra::Base }) do if params[:filter] - filters = params[:filter].split(',').map{ |f| @@filters[f.to_sym][:expr] }.compact + filters = params[:filter].split(',').map{ |f| @@filters[f.to_sym] ? @@filters[f.to_sym][:expr] : nil }.compact elsif params[:filters] # old param name for backwards compatibility - filters = params[:filters].split(',').map{ |f| @@filters[f.to_sym][:expr] }.compact + filters = params[:filters].split(',').map{ |f| @@filters[f.to_sym] ? @@filters[f.to_sym][:expr] : nil }.compact else filters = [] end |