[FIX] runbot_merge: possibly missing commit object in try_splitting

Would trigger a TypeError when trying to json.loads(False).
This commit is contained in:
Xavier Morel 2019-05-07 12:53:55 +02:00
parent eb91e2371b
commit c9f9b3050b

View File

@ -1278,7 +1278,7 @@ class Stagings(models.Model):
commit = self.env['runbot_merge.commit'].search([
('sha', '=', head)
])
statuses = json.loads(commit.statuses)
statuses = json.loads(commit.statuses or '{}')
reason = next((
ctx for ctx, result in statuses.items()
if to_status(result).get('state') in ('error', 'failure')