From be04e41555be38cadfab9f047f90a0d2aa7debe7 Mon Sep 17 00:00:00 2001 From: Yaroslav Yashin Date: Thu, 10 Oct 2024 17:22:51 +0200 Subject: [PATCH] Index error crash fixed --- plugins/phantom_streamer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/phantom_streamer.py b/plugins/phantom_streamer.py index 33323f0..3165449 100644 --- a/plugins/phantom_streamer.py +++ b/plugins/phantom_streamer.py @@ -36,8 +36,9 @@ def __init__(self, view: View) -> None: self.completion: str = '' self.phantom: Phantom | None = None self.phantom_id: int | None = None - logger.debug(f'view selection: {view.sel()[0]}') - self.selected_region = view.sel()[0] # saving only first selection to ease buffer logic + if len(view.sel()) > 0: + logger.debug(f'view selection: {view.sel()[0]}') + self.selected_region = view.sel()[0] # saving only first selection to ease buffer logic def update_completion(self, completion: str): line_beginning = self.view.line(self.view.sel()[0])