diff options
| author | Jeremy Kersten <jke@odoo.com> | 2018-05-22 10:36:22 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2018-05-22 10:39:35 +0200 |
| commit | 2a43614c3c00d57a4376eea44cd8cd1ed2d316b7 (patch) | |
| tree | e4858fd30540409ffc4da12fbaa5ae108d7faae9 /addons/web_editor | |
| parent | b709e22fa2911b7a2ffd8efda7e00845a887a03d (diff) | |
[FIX] web_editor: avoid traceback when open img editor
In some case, (e.g.: demo data), datas_fname is undefined and match of
undefined will crash and block the modal to be opened.
Uncaught TypeError: r.datas_fname.match is not a function
Diffstat (limited to 'addons/web_editor')
| -rw-r--r-- | addons/web_editor/static/src/js/widgets/widgets.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index f7c1c808016..b63568ff0bd 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -373,13 +373,13 @@ var ImageWidget = MediaWidget.extend({ .sortBy(function (r) { if (_.any(self.firstFilters, function (filter) { var regex = new RegExp(filter, 'i'); - return r.name.match(regex) || r.datas_fname.match(regex); + return r.name.match(regex) || r.datas_fname && r.datas_fname.match(regex); })) { return -1; } if (_.any(self.lastFilters, function (filter) { var regex = new RegExp(filter, 'i'); - return r.name.match(regex) || r.datas_fname.match(regex); + return r.name.match(regex) || r.datas_fname && r.datas_fname.match(regex); })) { return 1; } |
