From 30a0d88074542eb538f98e869d04e5ad58d8c853 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 25 Feb 2020 13:13:41 -0700 Subject: [PATCH] Don't print errors when the tab is used with no autocomplete present Fixes https://github.com/vector-im/riot-web/issues/12461 Not a release blocker because the error is caught, and is at the end of the function. Just log spam. --- src/components/views/rooms/BasicMessageComposer.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/BasicMessageComposer.js b/src/components/views/rooms/BasicMessageComposer.js index ff4e5e8385..e366a20326 100644 --- a/src/components/views/rooms/BasicMessageComposer.js +++ b/src/components/views/rooms/BasicMessageComposer.js @@ -471,10 +471,14 @@ export default class BasicMessageEditor extends React.Component { const addedLen = range.replace([partCreator.pillCandidate(range.text)]); return model.positionForOffset(caret.offset + addedLen, true); }); - await model.autoComplete.onTab(); - if (!model.autoComplete.hasSelection()) { - this.setState({showVisualBell: true}); - model.autoComplete.close(); + + // Don't try to do things with the autocomplete if there is none shown + if (model.autoComplete) { + await model.autoComplete.onTab(); + if (!model.autoComplete.hasSelection()) { + this.setState({showVisualBell: true}); + model.autoComplete.close(); + } } } catch (err) { console.error(err);