Unverified Commit 3ca93f10 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

don't run atof() on a NULL pointer in case a potential file has an empty line

parent 6354777d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -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);
  }
}