fix cannot read property match of undefined

This commit is contained in:
Berkeley Martinez
2015-08-18 19:23:43 -07:00
parent 0367a19ffc
commit 8c803281f6
2 changed files with 4 additions and 4 deletions

View File

@ -320,7 +320,7 @@ module.exports = function(app) {
var challengeData = {
id: challengeId,
name: req.body.challengeInfo.challengeName,
name: req.body.challengeInfo.challengeName || '',
completedDate: Math.round(+new Date()),
solution: req.body.challengeInfo.solution,
challengeType: 5
@ -399,7 +399,7 @@ module.exports = function(app) {
{
id: id || challengeId,
completedDate: completedDate,
name: name || challengeName,
name: name || challengeName || '',
solution: null,
githubLink: null,
verified: true
@ -446,7 +446,7 @@ module.exports = function(app) {
var challengeData = {
id: challengeId,
name: req.body.challengeInfo.challengeName,
name: req.body.challengeInfo.challengeName || '',
completedDate: completedDate,
solution: solutionLink,
githubLink: githubLink,

View File

@ -156,7 +156,7 @@ module.exports = function(app) {
});
const bonfires = user.completedChallenges.filter(function(obj) {
return obj.challengeType === 5 && obj.name.match(/Bonfire/g);
return obj.challengeType === 5 && (obj.name || '').match(/Bonfire/g);
});
res.render('account/show', {