Merge pull request #3596 from FreeCodeCamp/fix/500-out-of-range-bug
Fix 500 out of range bug when completing last challenge
This commit is contained in:
@ -180,9 +180,9 @@ module.exports = function(app) {
|
|||||||
'could not find challenge block for ' + challenge.block
|
'could not find challenge block for ' + challenge.block
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const nextBlock$ = blocks$.elementAt(blockIndex + 1);
|
const firstChallengeOfNextBlock$ = blocks$
|
||||||
const firstChallengeOfNextBlock$ = nextBlock$
|
.elementAtOrDefault(blockIndex + 1, {})
|
||||||
.map(block => block.challenges[0]);
|
.map(({ challenges = [] }) => challenges[0]);
|
||||||
|
|
||||||
return blocks$
|
return blocks$
|
||||||
.elementAt(blockIndex)
|
.elementAt(blockIndex)
|
||||||
@ -211,6 +211,9 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.map(nextChallenge => {
|
.map(nextChallenge => {
|
||||||
|
if (!nextChallenge) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
nextChallengeName = nextChallenge.dashedName;
|
nextChallengeName = nextChallenge.dashedName;
|
||||||
return nextChallengeName;
|
return nextChallengeName;
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user