summaryrefslogtreecommitdiffstats
path: root/app/models/wiki_page.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-15 11:41:24 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-15 11:41:24 +0000
commitc075626462e9cdfa607cd152ccfa661c9a602b2d (patch)
tree511a4a728c2eb8ac8833ece8073af350a3aeb182 /app/models/wiki_page.rb
parent218e5f40a15932206cf243e83fbdcfad5cc38cd6 (diff)
downloadredmine-c075626462e9cdfa607cd152ccfa661c9a602b2d.tar.gz
redmine-c075626462e9cdfa607cd152ccfa661c9a602b2d.zip
Fixed that requesting a specific version of a non-existent wiki page raises an error (#16255).
git-svn-id: http://svn.redmine.org/redmine/trunk@12971 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r--app/models/wiki_page.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index ba418118f..fc56d9d6b 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -104,9 +104,11 @@ class WikiPage < ActiveRecord::Base
end
def content_for_version(version=nil)
- result = content.versions.find_by_version(version.to_i) if version
- result ||= content
- result
+ if content
+ result = content.versions.find_by_version(version.to_i) if version
+ result ||= content
+ result
+ end
end
def diff(version_to=nil, version_from=nil)