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
|
||||
);
|
||||
}
|
||||
const nextBlock$ = blocks$.elementAt(blockIndex + 1);
|
||||
const firstChallengeOfNextBlock$ = nextBlock$
|
||||
.map(block => block.challenges[0]);
|
||||
const firstChallengeOfNextBlock$ = blocks$
|
||||
.elementAtOrDefault(blockIndex + 1, {})
|
||||
.map(({ challenges = [] }) => challenges[0]);
|
||||
|
||||
return blocks$
|
||||
.elementAt(blockIndex)
|
||||
@ -211,6 +211,9 @@ module.exports = function(app) {
|
||||
});
|
||||
})
|
||||
.map(nextChallenge => {
|
||||
if (!nextChallenge) {
|
||||
return null;
|
||||
}
|
||||
nextChallengeName = nextChallenge.dashedName;
|
||||
return nextChallengeName;
|
||||
})
|
||||
|
Reference in New Issue
Block a user