From a46a18fe560445ad4bc7c4353f30324fb676db0f Mon Sep 17 00:00:00 2001 From: xu biao Date: Wed, 7 Sep 2016 08:04:07 +0800 Subject: [PATCH] crush/CrushCompiler.cc:884 bug fix: index out of range Signed-off-by: xu biao --- src/crush/CrushCompiler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index 1ce72fbbcbdc..73d9f23d3561 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -881,7 +881,7 @@ int CrushCompiler::compile(istream& in, const char *infn) while (getline(in, str)) { // remove newline int l = str.length(); - if (l && str[l] == '\n') + if (l && str[l - 1] == '\n') str.erase(l-1, 1); line_val[line] = str; -- 2.47.3