diff options
-rw-r--r-- | src/fit.c | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -6071,14 +6071,26 @@ int main(int argc, char **argv) goto err; } - rv = zebra_get_bank(f,&b,mctk.orig); + if (mctk.orig == mctk.up - KMCVX_MCTK) { + /* This is the first MCTK bank. */ + unpack_mctk(mctk.data, &bmctk); + } else { + /* For some reason SNOMAN sometimes links to the second MCTK + * from the MCGN bank. */ + rv = zebra_get_bank(f,&b,mctk.orig); - if (rv) { - fprintf(stderr, "error getting MCTK bank: %s\n", zebra_err); - goto err; - } + if (b.idh != MCTK_RECORD) { + fprintf(stderr, "error following origin link from MCTK bank!\n"); + goto err; + } + + if (rv) { + fprintf(stderr, "error getting MCTK bank: %s\n", zebra_err); + goto err; + } - unpack_mctk(b.data, &bmctk); + unpack_mctk(b.data, &bmctk); + } if (mctk.up == 0) { fprintf(stderr, "MCVX link is zero!\n"); @@ -6199,7 +6211,7 @@ int main(int argc, char **argv) /* Note the origin link for the first EV bank points back to the * structural link location in the MAST bank. These links are super * confusing! */ - if ((b.orig == f->first_bank-KMAST_EV) || skip_second_event) break; + if ((b.orig == f->first_bank - KMAST_EV) || skip_second_event) break; rv = zebra_get_bank(f,&b,b.orig); |