From 09b95905dc2df3476ac46d2266bb6c9fd4bc2c93 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 6 Feb 2014 20:23:06 +0000 Subject: Make sure that Repository#extra_info returns a Hash or nil (#16032). git-svn-id: http://svn.redmine.org/redmine/trunk@12848 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/repository.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models') diff --git a/app/models/repository.rb b/app/models/repository.rb index 0185ca683..cfdfba57b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -153,6 +153,12 @@ class Repository < ActiveRecord::Base end end + # TODO: should return an empty hash instead of nil to avoid many ||{} + def extra_info + h = read_attribute(:extra_info) + h.is_a?(Hash) ? h : nil + end + def merge_extra_info(arg) h = extra_info || {} return h if arg.nil? -- cgit v1.2.3