detect invalid use and silence compiler warnings

This commit is contained in:
Axel Kohlmeyer
2021-08-24 14:27:20 -04:00
parent 8dd2428294
commit eaf5e08542

View File

@ -2471,7 +2471,7 @@ This function is called, e.g. from :doc:`fix property/atom <fix_property_atom>`.
*/
int Atom::add_custom(const char *name, int flag, int cols)
{
int index;
int index = -1;
if ((flag == 0) && (cols == 0)) {
index = nivector;
@ -2511,7 +2511,8 @@ int Atom::add_custom(const char *name, int flag, int cols)
dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols");
dcols[index] = cols;
}
if (index < 0)
error->all(FLERR,"Invalid call to Atom::add_custom()");
return index;
}