From 3948b6efe2f66916c1f18633993c23d5a0beda33 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Tue, 28 May 2013 09:43:13 -0700 Subject: [PATCH] Check for empty flags list IndexErrors are not fun. --- python/ycm/completers/cpp/clang_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ycm/completers/cpp/clang_helpers.py b/python/ycm/completers/cpp/clang_helpers.py index ae8374af..7dec8bd0 100644 --- a/python/ycm/completers/cpp/clang_helpers.py +++ b/python/ycm/completers/cpp/clang_helpers.py @@ -22,6 +22,6 @@ def PrepareClangFlags( flags, filename ): # When flags come from the compile_commands.json file, the first flag is # usually the path to the compiler that should be invoked. We want to strip # that. - if not flags[ 0 ].startswith( '-' ): + if flags and not flags[ 0 ].startswith( '-' ): return flags[ 1: ] return flags