diff --git a/addons/im_livechat/static/src/core/web/suggestion_service_patch.js b/addons/im_livechat/static/src/core/web/suggestion_service_patch.js index 9cfd68bdf9a..b86eb2926ec 100644 --- a/addons/im_livechat/static/src/core/web/suggestion_service_patch.js +++ b/addons/im_livechat/static/src/core/web/suggestion_service_patch.js @@ -12,7 +12,7 @@ patch(SuggestionService.prototype, { : super.getSupportedDelimiters(...arguments); }, async fetchSuggestions({ delimiter, term }, { thread } = {}) { - if (thread.type === "livechat" && delimiter === "#") { + if (thread?.type === "livechat" && delimiter === "#") { return; } return super.fetchSuggestions(...arguments); @@ -30,7 +30,7 @@ patch(SuggestionService.prototype, { * @returns {[mainSuggestion[], extraSuggestion[]]} */ searchSuggestions({ delimiter, term }, { thread } = {}, sort = false) { - if (thread.type === "livechat" && delimiter === "#") { + if (thread?.type === "livechat" && delimiter === "#") { return { type: undefined, mainSuggestions: [],