]> source.dussan.org Git - redmine.git/commitdiff
Code cleanup, use safer #closed?
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 24 Oct 2014 21:40:26 +0000 (21:40 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 24 Oct 2014 21:40:26 +0000 (21:40 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13505 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb

index 462d7d99f7190f225152e614d4ac270b4d2cb7a6..910359bf5eb3d5345dadec45ad0741f32705ed57 100644 (file)
@@ -688,7 +688,7 @@ class Issue < ActiveRecord::Base
 
   # Return true if the issue is closed, otherwise false
   def closed?
-    self.status.is_closed?
+    status.present? && status.is_closed?
   end
 
   # Return true if the issue is being reopened
@@ -706,7 +706,7 @@ class Issue < ActiveRecord::Base
   # Return true if the issue is being closed
   def closing?
     if !new_record? && status_id_changed?
-      if status_was && status && !status_was.is_closed? && status.is_closed?
+      if closed? && status_was && !status_was.is_closed?
         return true
       end
     end