Merge remote-tracking branch 'origin/release-4-6'
[alexxy/gromacs.git] / src / gromacs / gmxlib / index.c
index 6fff42416ee209cfcace96d88f900b1fb8ea2cf4..c92b5809034bfa9d4510faf48b6af26752c529ea 100644 (file)
@@ -921,6 +921,10 @@ t_blocka *init_index(const char *gfile, char ***grpname)
        b->index[b->nr]=b->index[b->nr-1];
        (*grpname)[b->nr-1]=strdup(str);
       } else {
+          if (b->nr==0)
+          {
+              gmx_fatal(FARGS,"The first header of your indexfile is invalid");
+          }
        pt=line;
        while (sscanf(pt,"%s",str) == 1) {
          i=b->index[b->nr];