summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-06 20:23:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-06 20:23:06 +0000
commit09b95905dc2df3476ac46d2266bb6c9fd4bc2c93 (patch)
tree85d932a333caf029678c75179c801e65255ec281 /app/models
parenta0baf7ee5d41470d0f2a833d7d7f719a62f282eb (diff)
downloadredmine-09b95905dc2df3476ac46d2266bb6c9fd4bc2c93.tar.gz
redmine-09b95905dc2df3476ac46d2266bb6c9fd4bc2c93.zip
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
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb6
1 files changed, 6 insertions, 0 deletions
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?