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; }