← Back to Challenges / Challenge #2

Null Pointer Dereference in User Service

★★☆☆☆
📁 expressjs/express 🔢 def5678 Null Pointer
★★☆☆☆
Difficulty
+75 XP reward
UserService.js.js | 8 lines
Original (Buggy) Read-only
1
2
3
4
5
6
7
8
function getUserProfile(userId) {
const user = database.findUser(userId);
return {
name: user.name,
email: user.email,
profile: user.profile.displayName
};
}
Your Fix Editable
1
2
3
4
5
6
7
8
0 added 0 removed 0 changed
Click lines on the left to mark as buggy

Submit Your Fix

Lines marked: 0

Edit the code on the right panel above to fix the bugs. Changes are highlighted in real-time.

Removed   Changed   Added    Click lines on the left to mark buggy lines