[Bug] Null reading on User matches
Closed this issue · 0 comments
estelle-rcr commented
Describe the bug
lors d'un match, coté backend on a les erreurs suivantes :
prod-backend | [Nest] 565 - 11/21/2022, 2:35:35 PM ERROR [ExceptionsHandler] Cannot read properties of null (reading 'playerOneMatch')
prod-backend | TypeError: Cannot read properties of null (reading 'playerOneMatch')
prod-backend | at UserService.getUserMatches (/home/app/dist/src/user/user.service.js:396:41)
prod-backend | at async UserService.getUserMatchHistory (/home/app/dist/src/user/user.service.js:429:29)
prod-backend | at async /home/app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
prod-backend | at async /home/app/node_modules/@nestjs/core/router/router-proxy.js:9:17
nginx | 172.21.0.1 - - [21/Nov/2022:14:35:35 +0000] "POST /api/user/get-user-matches-stats HTTP/1.1" 500 52 "https://transcendance.jcts.io/profile/leales" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1" "-"
prod-backend | [Nest] 565 - 11/21/2022, 2:35:35 PM ERROR [ExceptionsHandler] Cannot read properties of null (reading 'eloScore')
prod-backend | TypeError: Cannot read properties of null (reading 'eloScore')
prod-backend | at UserService.getUserMatchesStats (/home/app/dist/src/user/user.service.js:416:28)
prod-backend | at async /home/app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
prod-backend | at async /home/app/node_modules/@nestjs/core/router/router-proxy.js:9:17
-
même problème dans user.services lignes 454 et 459. Rajouter un ? à matches :
if (matches?.playerOneMatch !== null) {
for (let i = 0; i < matches.playerOneMatch.length; i++) {
matchesList.push(matches.playerOneMatch[i]);
}
}
if (matches?.playerOneMatch !== null) {
for (let i = 0; i < matches.playerTwoMatch.length; i++) {
matchesList.push(matches.playerTwoMatch[i]);
}
} -
changer ligne 459 playerOneMatch pour playerTwoMatch
Steps to reproduce
launch a game between two player on transcendence.jcts.io
Expected behavior
no error on the backend
Environment
No response
OS
No response
Browser
No response
Version
No response
Additional context
No response
Relevant log output
No response