From 45cb0b8cc59dbe39b59eef1a85fd38fa88997ccc Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 12 Jan 2018 16:06:39 -0800 Subject: [PATCH] Fix message_handler.cc when range is invalid --- src/message_handler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/message_handler.cc b/src/message_handler.cc index 1bf6c50e..31c37590 100644 --- a/src/message_handler.cc +++ b/src/message_handler.cc @@ -141,7 +141,8 @@ void EmitSemanticHighlighting(QueryDatabase* db, // shrinking hack, the contained keywords and primitive types will be // highlighted undesiredly. auto concise_name = detailed_name.substr(0, detailed_name.find('<')); - if (sym.loc.range.start.line <= working_file->index_lines.size()) { + if (0 < sym.loc.range.start.line && + sym.loc.range.start.line <= working_file->index_lines.size()) { const std::string& line = working_file->index_lines[sym.loc.range.start.line - 1]; sym.loc.range.end.line = sym.loc.range.start.line;