[sequence] Fixed crash due to undefined sequence

Change-Id: Ie67ff4aa9a53eb8b04535e3b61737e11c9049316
This commit is contained in:
Arthur Camouseigt
2020-09-14 12:41:29 +02:00
committed by Émilie Feral
parent b8544e3708
commit 51002066e9
7 changed files with 27 additions and 10 deletions

View File

@@ -87,9 +87,14 @@ void TemplatedSequenceContext<T>::step(SequenceContext * sqctx, int sequenceInde
SequenceStore * sequenceStore = sqctx->sequenceStore();
stop = stepMultipleSequences ? sequenceStore->numberOfModels() : start + 1;
for (int i = start; i < stop; i++) {
Sequence * u = sequenceStore->modelForRecord(sequenceStore->recordAtIndex(i));
int index = stepMultipleSequences ? SequenceStore::sequenceIndexForName(u->fullName()[0]) : 0;
sequences[index] = u->isDefined() ? u : nullptr;
Ion::Storage::Record record = sequenceStore->recordAtIndex(i);
if (!record.isNull()) {
Sequence * u = sequenceStore->modelForRecord(record);
int index = stepMultipleSequences ? SequenceStore::sequenceIndexForName(u->fullName()[0]) : 0;
sequences[index] = u->isDefined() ? u : nullptr;
} else {
sequences[i] = nullptr;
}
}
// We approximate the value of the next rank for each sequence we want to update