diff --git a/frontend/src/ts/test/test-logic.ts b/frontend/src/ts/test/test-logic.ts index afff0d9b1..7fc84c72d 100644 --- a/frontend/src/ts/test/test-logic.ts +++ b/frontend/src/ts/test/test-logic.ts @@ -1706,7 +1706,7 @@ async function saveResult( return Notifications.add("Failed to save result: " + response.message, -1); } - if (response.data.xp) { + if (response?.data?.xp) { const snapxp = DB.getSnapshot().xp; AccountButton.updateXpBar( snapxp, @@ -1716,12 +1716,12 @@ async function saveResult( DB.addXp(response.data.xp); } - if (response.data.streak) { + if (response?.data?.streak) { DB.setStreak(response.data.streak); } completedEvent._id = response.data.insertedId; - if (response.data.isPb) { + if (response?.data?.isPb) { completedEvent.isPb = true; } @@ -1735,7 +1735,7 @@ async function saveResult( AnalyticsController.log("testCompleted"); - if (response.data.isPb) { + if (response?.data?.isPb) { //new pb Result.showCrown(); Result.updateCrown(); @@ -1764,7 +1764,7 @@ async function saveResult( // ); // } - if (!response.data.dailyLeaderboardRank) { + if (!response?.data?.dailyLeaderboardRank) { $("#result .stats .dailyLeaderboard").addClass("hidden"); } else { $("#result .stats .dailyLeaderboard")