diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-05-09 14:08:47 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-05-09 14:54:15 +0200 |
| commit | 7e98e32959231b68985b444afbcde06bf64a5fb7 (patch) | |
| tree | 381d012bde2bdd43c2b28754b5e7c2bf6433a190 /addons/web/static/src | |
| parent | e25563dca609880a6df919ec8ac389c44299d9b3 (diff) | |
[FIX] web: traceback when quickly clicking on back button
Before this rev., there might be a crash when the user quickly
clicked several times on the browser's back button. This crash
occurred in the code saving/restoring the scroll position of the
current action.
When clicking fast on the back button, several actions are
executed but don't wait for each other (those actions are triggered
by the hashchange event), so when it is fast, and mainly when the
appswitcher is involved, it may happen that we try to get the
scroll position of an action that isn't loaded yet.
opw~741814
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/action_manager.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js index 7e8b89dda68..974bfb982d7 100644 --- a/addons/web/static/src/js/action_manager.js +++ b/addons/web/static/src/js/action_manager.js @@ -175,13 +175,18 @@ var ViewManagerAction = WidgetAction.extend({ * @param {int} [scrollTop] the number of pixels to scroll */ set_scrollTop: function(scrollTop) { - this.widget.active_view.controller.set_scrollTop(scrollTop); + if (this.widget.active_view && this.widget.active_view.controller) { + this.widget.active_view.controller.set_scrollTop(scrollTop); + } }, /** * @return {int} the number of pixels the webclient is scrolled when leaving the action */ get_scrollTop: function() { - return this.widget.active_view.controller.get_scrollTop(); + if (this.widget.active_view && this.widget.active_view.controller) { + return this.widget.active_view.controller.get_scrollTop(); + } + return this._super.apply(this, arguments); }, /** * @return {Array} array of Objects that will be interpreted to display the breadcrumbs |
