correct compute argument count check, avoid segfault

This commit is contained in:
Axel Kohlmeyer
2025-02-14 16:55:09 -05:00
parent 7f82dcd835
commit ca5015eaea
2 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) :
{ {
instance_me = instance_total++; instance_me = instance_total++;
if (narg < 3) error->all(FLERR,"Illegal compute command"); if (narg < 3) utils::missing_cmd_args(FLERR,"compute", error);
// compute ID, group, and style // compute ID, group, and style
// ID must be all alphanumeric chars or underscores // ID must be all alphanumeric chars or underscores

View File

@ -27,7 +27,7 @@ using namespace LAMMPS_NS;
ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) : ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), id_fix(nullptr) Compute(lmp, narg, arg), id_fix(nullptr)
{ {
if (narg > 2) error->all(FLERR, 3, "Compute vacf does not accept any arguments"); if (narg > 3) error->all(FLERR, 3, "Compute vacf does not accept any arguments");
vector_flag = 1; vector_flag = 1;
size_vector = 4; size_vector = 4;