summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-09-19 13:22:43 +0100
committerGitHub <noreply@github.com>2018-09-19 13:22:43 +0100
commit6bbbb9456c786f2e781ccc997bbc46d7530f8450 (patch)
tree9d50cb2f393748031ea09ce069b922fc6763ce5b
parente5b920e387e08411ac1e3ade8bb54db5a7945ece (diff)
parent3c067941f1d4768ad803843e3fe33c6a5581f0a7 (diff)
downloadale-6bbbb9456c786f2e781ccc997bbc46d7530f8450.zip
Merge pull request #1926 from gnustomp/master
c#ParseCFlags: don't index empty list
-rw-r--r--autoload/ale/c.vim2
-rw-r--r--test/test_c_flag_parsing.vader2
2 files changed, 2 insertions, 2 deletions
diff --git a/autoload/ale/c.vim b/autoload/ale/c.vim
index e7b43d88..ce59ae31 100644
--- a/autoload/ale/c.vim
+++ b/autoload/ale/c.vim
@@ -55,7 +55,7 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
" Check if cflag contained a '-' and should not have been splitted
let l:option_list = split(l:option, '\zs')
- if l:option_list[-1] isnot# ' '
+ if len(l:option_list) > 0 && l:option_list[-1] isnot# ' '
continue
endif
diff --git a/test/test_c_flag_parsing.vader b/test/test_c_flag_parsing.vader
index a4e00452..f7bfaa04 100644
--- a/test/test_c_flag_parsing.vader
+++ b/test/test_c_flag_parsing.vader
@@ -74,7 +74,7 @@ Execute(ParseCFlags should ignore -T and other arguments):
\ . ' -DTEST=`date +%s`',
\ ale#c#ParseCFlags(
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
- \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
+ \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir --sysroot=subdir '
\ . '-I'. ale#path#Simplify('kernel/include')
\ . ' -DTEST=`date +%s` -c file.c'
\ )