From 2e762d368e4a00144b44af107e4d3844ee4f6567 Mon Sep 17 00:00:00 2001 From: SammCheese Date: Mon, 3 Apr 2023 19:19:42 +0200 Subject: [PATCH] fix: add nullcheck for legacy speed settings --- src/renderer/components/Preference/Basic.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue index 601bce501..2ca956683 100644 --- a/src/renderer/components/Preference/Basic.vue +++ b/src/renderer/components/Preference/Basic.vue @@ -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 @@ -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