diff options
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r-- | vim-mode/vim_mode.pl | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 575d697..4eacf55 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1520,10 +1520,16 @@ sub ex_buffer { Irssi::command('window last'); # Go to best regex matching window. } else { - my $matches = _matching_windows($buffer); - if (scalar @$matches > 0) { - $window = @$matches[0]->{window}; - $item = @$matches[0]->{item}; + eval { + my $matches = _matching_windows($buffer); + if (scalar @$matches > 0) { + $window = @$matches[0]->{window}; + $item = @$matches[0]->{item}; + } + }; + # Catch errors in /$buffer/ regex. + if ($@) { + _warn($@); } } @@ -1831,8 +1837,14 @@ sub b_windows_cb { my $buffer = $1; if ($buffer !~ /^[0-9]$/ and $buffer ne '#') { # Display matching windows. - my $matches = _matching_windows($buffer); - $windows = join ',', map { $_->{text} } @$matches; + eval { + my $matches = _matching_windows($buffer); + $windows = join ',', map { $_->{text} } @$matches; + }; + # Catch errors in /$buffer/ regex. + if ($@) { + _warn($@); + } } } |