forked from lijiext/lammps
don't run atof() on a NULL pointer in case a potential file has an empty line
This commit is contained in:
parent
6354777d09
commit
3ca93f10b3
|
@ -927,7 +927,7 @@ void PairADP::grab(FILE *fp, char *filename, int n, double *list)
|
|||
while (i < n) {
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,filename,error);
|
||||
ptr = strtok(line," \t\n\r\f");
|
||||
list[i++] = atof(ptr);
|
||||
if (ptr) list[i++] = atof(ptr);
|
||||
while ((ptr = strtok(NULL," \t\n\r\f"))) list[i++] = atof(ptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -797,7 +797,7 @@ void PairEAM::grab(FILE *fptr, int n, double *list)
|
|||
while (i < n) {
|
||||
utils::sfgets(FLERR,line,MAXLINE,fptr,NULL,error);
|
||||
ptr = strtok(line," \t\n\r\f");
|
||||
list[i++] = atof(ptr);
|
||||
if (ptr) list[i++] = atof(ptr);
|
||||
while ((ptr = strtok(NULL," \t\n\r\f"))) list[i++] = atof(ptr);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue