detect invalid use and silence compiler warnings
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user