From cb32bb972bf56a0e0c96937bcf368af0299d523a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jul 2021 20:57:42 -0400 Subject: [PATCH] fix bugs in ArgInfo class --- src/arg_info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arg_info.cpp b/src/arg_info.cpp index b83bb141fa..a274b47b92 100644 --- a/src/arg_info.cpp +++ b/src/arg_info.cpp @@ -68,11 +68,11 @@ ArgInfo::ArgInfo(const std::string &arg, int allowed) : type(NONE), dim(0), inde } else has_idx2 = arg.size(); - if (arg[has_idx2 - 1] != ']') { + if ((arg[has_idx2 - 1] != ']') || ((dim == 1) && (arg.find(']') != has_idx2 - 1))) { type = UNKNOWN; } else { try { - index1 = std::stoi(arg.substr(has_idx1 + 1, arg.size() - (has_idx2 + 2))); + index1 = std::stoi(arg.substr(has_idx1 + 1, arg.size() - (has_idx1 + 2))); } catch (std::invalid_argument &) { type = UNKNOWN; }