From 57e95590e8d99fe1e71e940f5c245afb6bc77f9a Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 19 Jan 2018 23:23:50 -0800 Subject: [PATCH] Remove GetIndexPosFromBufferPos range check --- src/working_files.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/working_files.cc b/src/working_files.cc index 9b98b44f..c21df53a 100644 --- a/src/working_files.cc +++ b/src/working_files.cc @@ -332,15 +332,8 @@ optional WorkingFile::GetBufferPosFromIndexPos(int line, int* column, bool optional WorkingFile::GetIndexPosFromBufferPos(int line, int* column, bool is_end) { // See GetBufferLineFromIndexLine for additional comments. - - // Note: |index_line| and |buffer_line| are 1-based. - if (line < 0 || line >= (int)buffer_lines.size()) { - loguru::Text stack = loguru::stacktrace(); - LOG_S(WARNING) << "Bad buffer_line (got " << line - << ", expected [1, " << buffer_lines.size() << "]) in " - << filename << stack.c_str(); + if (line < 0 || line >= (int)buffer_lines.size()) return nullopt; - } if (buffer_to_index.empty()) ComputeLineMapping();