[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.
This commit is contained in:
Martin Geubelle
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent 8f8e8b6e0e
commit caf0ec37a6
@@ -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();
}
});
});
});