From a1c89f5108468f71c78ff3e062356e524c7c4471 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Tue, 5 Feb 2013 20:12:43 -0800 Subject: [PATCH] Fix rare traceback on d. Fixes #43 --- python/completers/cpp/clang_completer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/completers/cpp/clang_completer.py b/python/completers/cpp/clang_completer.py index 7ffbd971..2c720855 100644 --- a/python/completers/cpp/clang_completer.py +++ b/python/completers/cpp/clang_completer.py @@ -38,6 +38,7 @@ class ClangCompleter( Completer ): self.last_prepared_diagnostics = [] self.parse_future = None self.flags = Flags() + self.diagnostic_store = None def SupportedFiletypes( self ): @@ -163,8 +164,12 @@ class ClangCompleter( Completer ): current_column += 1 current_file = vim.current.buffer.name - diagnostics = self.diagnostic_store[ current_file ][ current_line ] + if not self.diagnostic_store: + vimsupport.PostVimMessage( "No diagnostic for current line!" ) + return + + diagnostics = self.diagnostic_store[ current_file ][ current_line ] if not diagnostics: vimsupport.PostVimMessage( "No diagnostic for current line!" ) return