diff --git a/src/colvartypes.h b/src/colvartypes.h index 5f3b1bd61..bc10cd1e0 100644 --- a/src/colvartypes.h +++ b/src/colvartypes.h @@ -345,7 +345,7 @@ template class colvarmodule::vector1d std::stringstream stream(s); size_t i = 0; if (this->size()) { - while ((stream >> (*this)[i]) && (i < this->size())) { + while ((i < this->size()) && (stream >> (*this)[i])) { i++; } if (i < this->size()) {