Added a guard against trying to fetch milestones for a group value of None.

- Legacy-Id: 12988
This commit is contained in:
Henrik Levkowetz 2017-03-08 15:14:58 +00:00
parent e48b5c99c3
commit 707b006d17

View file

@ -126,10 +126,11 @@ def historic_milestones_for_charter(charter, rev):
just_before_next_rev = datetime.datetime.now()
res = []
for m in charter.chartered_group.groupmilestone_set.all():
mh = find_history_active_at(m, just_before_next_rev)
if mh and mh.state_id == need_state:
res.append(mh)
if charter.chartered_group:
for m in charter.chartered_group.groupmilestone_set.all():
mh = find_history_active_at(m, just_before_next_rev)
if mh and mh.state_id == need_state:
res.append(mh)
return res