From caf0ec37a667646bd54782ee4fab416482c1ea6a Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Wed, 29 Mar 2017 14:24:46 +0200 Subject: [PATCH] [FIX] web: do not call method on undefined controller As `create_view` is asynchronous, it is possible that there is an active view without any associated controller. We thus test here if there is a controller before calling its method. --- addons/web/static/src/js/chrome/view_manager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/view_manager.js b/addons/web/static/src/js/chrome/view_manager.js index 391e0d05ebf..02250d5cc15 100644 --- a/addons/web/static/src/js/chrome/view_manager.js +++ b/addons/web/static/src/js/chrome/view_manager.js @@ -178,7 +178,9 @@ var ViewManager = Widget.extend(ControlPanelMixin, { } core.bus.on('clear_uncommitted_changes', self, function(chain_callbacks) { chain_callbacks(function() { - return self.active_view.controller.canBeDiscarded(); + if (self.active_view.controller) { + return self.active_view.controller.canBeDiscarded(); + } }); }); });