From c2a5b52767c14cb3c46bf174fda207bac1dda499 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 14 Nov 2017 15:04:37 +0100 Subject: [PATCH] fix bug when removing all keywords in protocol --- app/controllers/protocols_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 9116cb4d4..4b944f316 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -180,8 +180,10 @@ class ProtocolsController < ApplicationController def update_keywords respond_to do |format| # sanitize user input - params[:keywords].collect! do |keyword| - escape_input(keyword) + if params[:keywords] + params[:keywords].collect! do |keyword| + escape_input(keyword) + end end if @protocol.update_keywords(params[:keywords]) format.json do