Assume a position of 0 if position is null.

This commit is contained in:
David Joy
2020-01-15 12:44:30 -05:00
parent c48d2ab9a2
commit 2fba819c34

View File

@@ -51,7 +51,8 @@ function SequenceContainer({
useEffect(() => {
if (loaded && !unitId) {
const position = metadata.position - 1;
// The position may be null, in which case we'll just assume 0.
const position = metadata.position !== null ? metadata.position - 1 : 0;
const nextUnitId = metadata.items[position].id;
history.push(`/course/${courseUsageKey}/${sequenceId}/${nextUnitId}`);
}