summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-26 23:31:43 +0100
committerw0rp <devw0rp@gmail.com>2017-04-26 23:32:20 +0100
commitb25dbd6ea5725591b32f6b4379dd4993b454e523 (patch)
tree0871857934c337bb69e917a7d5199cf7e24633df
parentce2f777e33f25c01830a0e62cc3ae23a8ba80953 (diff)
downloadale-b25dbd6ea5725591b32f6b4379dd4993b454e523.zip
Fix #506 - Don't set signs for buffers which don't exist
-rw-r--r--autoload/ale/sign.vim6
-rw-r--r--test/sign/test_sign_placement.vader3
2 files changed, 9 insertions, 0 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim
index e002f584..0e0250bf 100644
--- a/autoload/ale/sign.vim
+++ b/autoload/ale/sign.vim
@@ -169,6 +169,12 @@ endfunction
" This function will set the signs which show up on the left.
function! ale#sign#SetSigns(buffer, loclist) abort
+ if !bufexists(str2nr(a:buffer))
+ " Stop immediately when attempting to set signs for a buffer which
+ " does not exist.
+ return
+ endif
+
" Find the current markers
let l:current_sign_list = ale#sign#FindCurrentSigns(a:buffer)
diff --git a/test/sign/test_sign_placement.vader b/test/sign/test_sign_placement.vader
index 396ef5c4..518e1b81 100644
--- a/test/sign/test_sign_placement.vader
+++ b/test/sign/test_sign_placement.vader
@@ -132,3 +132,6 @@ Execute(Loclist items with sign_id values should be kept):
\ ['16', '1000004', 'ALEErrorSign'],
\ ],
\ ParseSigns()
+
+Execute(No excpetions should be thrown when setting signs for invalid buffers):
+ call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}])