diff --git a/SelectionHighlight/MatchTagger.cs b/SelectionHighlight/MatchTagger.cs index a0a31fa..eca24bc 100644 --- a/SelectionHighlight/MatchTagger.cs +++ b/SelectionHighlight/MatchTagger.cs @@ -96,11 +96,15 @@ private void FindWordsInDocument() { Task.Factory.StartNew(() => { - var findData = + // By this time the selection might have gone + if (!_selectedWord.IsEmpty) + { + var findData = new FindData(_selectedWord.GetText(), _selectedWord.Snapshot) { FindOptions = FindOptions.WholeWord }; - _glyphsToPlace.AddRange(_textSearchService.FindAll(findData)); + _glyphsToPlace.AddRange(_textSearchService.FindAll(findData)); + } }); } } } -} \ No newline at end of file +}