summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/handlers/gcc.vim8
-rw-r--r--test/handler/test_gcc_handler.vader8
2 files changed, 14 insertions, 2 deletions
diff --git a/autoload/ale/handlers/gcc.vim b/autoload/ale/handlers/gcc.vim
index a3f2a302..b7db09eb 100644
--- a/autoload/ale/handlers/gcc.vim
+++ b/autoload/ale/handlers/gcc.vim
@@ -82,8 +82,12 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
" If the 'error type' is a note, make it detail related to
" the previous error parsed in output
if l:match[4] is# 'note'
- let l:output[-1]['detail'] = get(l:output[-1], 'detail', '')
- \ . s:RemoveUnicodeQuotes(l:match[0]) . "\n"
+ if !empty(l:output)
+ let l:output[-1]['detail'] =
+ \ get(l:output[-1], 'detail', '')
+ \ . s:RemoveUnicodeQuotes(l:match[0]) . "\n"
+ endif
+
continue
endif
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader
index be9e90ee..321dbc6e 100644
--- a/test/handler/test_gcc_handler.vader
+++ b/test/handler/test_gcc_handler.vader
@@ -128,3 +128,11 @@ Execute(The GCC handler should handle syntax errors):
\ '<stdin>:4: error: ''cat'' was not declared in this scope',
\ '<stdin>:12: error: expected `;'' before ''o''',
\ ])
+
+Execute(The GCC handler should handle notes with no previous message):
+ AssertEqual
+ \ [],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ '<stdin>:1:1: note: x',
+ \ '<stdin>:1:1: note: x',
+ \ ])