Skip to content

Commit

Permalink
fix: add nullcheck for legacy speed settings (#1417)
Browse files Browse the repository at this point in the history
  • Loading branch information
SammCheese authored Apr 4, 2023
1 parent 7201f17 commit ecf5958
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/renderer/components/Preference/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,10 @@
},
downloadUnits: {
get () {
const speedEnding = this.form.maxOverallDownloadLimit?.slice(-1)
const speed = this.form.maxOverallDownloadLimit
// Fallback to K if Speed is 0 (previously unlimited)
if (!speed) return 'K'
const speedEnding = speed.slice(-1)
// Fall back to KB if the downloadlimit doesnt have a unit
if (!speedEnding || !isNaN(parseInt(speedEnding))) return 'K'
return speedEnding
Expand All @@ -425,7 +428,10 @@
},
uploadUnits: {
get () {
const speedEnding = this.form.maxOverallUploadLimit?.slice(-1)
const speed = this.form.maxOverallUploadLimit
// Fallback to K if Speed is 0 (previously unlimited)
if (!speed) return 'K'
const speedEnding = speed.slice(-1)
// Fall back to KB if the downloadlimit doesnt have a unit
if (!speedEnding || !isNaN(parseInt(speedEnding))) return 'K'
return speedEnding
Expand Down

0 comments on commit ecf5958

Please sign in to comment.