diff options
| author | Simon Ruderich <simon@ruderich.org> | 2010-10-08 23:57:10 +0000 | 
|---|---|---|
| committer | Simon Ruderich <simon@ruderich.org> | 2010-10-08 23:58:10 +0000 | 
| commit | a676f809891739c143f52c52c72e28ef296ccc15 (patch) | |
| tree | 165c8c3cad468ea3615f159a600fa1bdbaaf903e /vim-mode | |
| parent | vim_moderc: Add [!] to :mkv[imrc]. (diff) | |
| download | irssi-scripts-a676f809891739c143f52c52c72e28ef296ccc15.tar.gz irssi-scripts-a676f809891739c143f52c52c72e28ef296ccc15.zip | |
vim_mode: Fix vim_mode.pl crash with invalid regex in :b.
Diffstat (limited to 'vim-mode')
| -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($@); +            }          }      } | 
