summaryrefslogtreecommitdiffstats
path: root/app/models/issue_relation.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-04 18:10:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-04 18:10:02 +0000
commit7fb0fe2e910a4188db283c359d9b1d05dad99041 (patch)
tree806966efe70a79f607ae69ba07ff1d5dbfe4c1ed /app/models/issue_relation.rb
parent224921460a0a3d9c97813e4a64f0903adffff22f (diff)
downloadredmine-7fb0fe2e910a4188db283c359d9b1d05dad99041.tar.gz
redmine-7fb0fe2e910a4188db283c359d9b1d05dad99041.zip
Safer code in IssueRelation (#7018).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4467 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_relation.rb')
-rw-r--r--app/models/issue_relation.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb
index b79592291..8f2db40f3 100644
--- a/app/models/issue_relation.rb
+++ b/app/models/issue_relation.rb
@@ -84,14 +84,15 @@ class IssueRelation < ActiveRecord::Base
def set_issue_to_dates
soonest_start = self.successor_soonest_start
- if soonest_start
+ if soonest_start && issue_to
issue_to.reschedule_after(soonest_start)
end
end
def successor_soonest_start
- return nil unless (TYPE_PRECEDES == self.relation_type) && (issue_from.start_date || issue_from.due_date)
- (issue_from.due_date || issue_from.start_date) + 1 + delay
+ if (TYPE_PRECEDES == self.relation_type) && delay && issue_from && (issue_from.start_date || issue_from.due_date)
+ (issue_from.due_date || issue_from.start_date) + 1 + delay
+ end
end
def <=>(relation)