diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index 8969be69..95e82e71 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -210,9 +210,10 @@ class Runbot(Controller): def force_bundle(self, bundle, auto_rebase=False, **_post): _logger.info('user %s forcing bundle %s', request.env.user.name, bundle.name) # user must be able to read bundle batch = bundle.sudo()._force() - batch._log('Batch forced by %s', request.env.user.name) - batch._prepare(auto_rebase) - return werkzeug.utils.redirect('/runbot/batch/%s' % batch.id) + if batch: + batch._log('Batch forced by %s', request.env.user.name) + batch._prepare(auto_rebase) + return werkzeug.utils.redirect('/runbot/batch/%s' % batch.id) @route(['/runbot/batch/'], website=True, auth='public', type='http', sitemap=False) def batch(self, batch_id=None, **kwargs):