Skip to content

Commit c926d50

Browse files
committed
security check for heat score
1 parent bdf7827 commit c926d50

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

frontend/src/components/app/users/UserProfile.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,14 @@ export default {
254254
const sliderRangesRequest = await this.$http.get('/search/values');
255255
const maxScore = sliderRangesRequest.data.search_minmax.max_score;
256256
const sliderScore = document.getElementById('sliderScore');
257-
const sliderScoreWidth = `${sliderScore.getBoundingClientRect().width}px`;
258-
const marginLeft = `${(this.user.heat_score / maxScore) * 100}%`;
259-
if (this.user.heat_score / maxScore < 0.2) {
260-
sliderScore.style.marginLeft = `${marginLeft}`;
261-
} else {
262-
sliderScore.style.marginLeft = `calc(${marginLeft} - ${sliderScoreWidth})`;
257+
if (sliderScore) {
258+
const sliderScoreWidth = `${sliderScore.getBoundingClientRect().width}px`;
259+
const marginLeft = `${(this.user.heat_score / maxScore) * 100}%`;
260+
if (this.user.heat_score / maxScore < 0.2) {
261+
sliderScore.style.marginLeft = `${marginLeft}`;
262+
} else {
263+
sliderScore.style.marginLeft = `calc(${marginLeft} - ${sliderScoreWidth})`;
264+
}
263265
}
264266
},
265267
};

0 commit comments

Comments
 (0)