diff options
author | Thomas White <taw@physics.org> | 2021-03-01 15:29:32 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-03-01 15:29:32 +0100 |
commit | 2b4584205040c6af9d5915103e938651d534b5d9 (patch) | |
tree | 6ed9a41dbc83c5cec4cad46e27e552f083de099b /src | |
parent | da5e9537d64b58e502cfdfcfbfdc161383d33bc8 (diff) |
GUI: Fix counting of processed frames during indexing
Diffstat (limited to 'src')
-rw-r--r-- | src/gui_index.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui_index.c b/src/gui_index.c index 4862ab72..450030d2 100644 --- a/src/gui_index.c +++ b/src/gui_index.c @@ -794,7 +794,7 @@ char **indexamajig_command_line(const char *geom_filename, int read_number_processed(const char *filename) { FILE *fh = fopen(filename, "r"); - int n_proc; + int n_proc = 0; /* Normal situation if SLURM job hasn't started yet */ if ( fh == NULL ) return 0; @@ -804,9 +804,15 @@ int read_number_processed(const char *filename) if ( fgets(line, 1024, fh) == NULL ) break; if ( strncmp(line, "Final: ", 7) == 0 ) { - sscanf(line, "Final: %i images processed", &n_proc); + int i; + if ( sscanf(line, "Final: %i images processed", &i) == 1 ) { + n_proc = i; + } } else if ( strstr(line, " images processed, ") != NULL ) { - sscanf(line, "%i ", &n_proc); + int i; + if ( sscanf(line, "%i ", &i) == 1 ) { + n_proc = i; + } } } while ( 1 ); |