diff --git a/package.json b/package.json index 52b0aae..365be38 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PowerControl", - "version": "2.4.8", + "version": "2.4.9", "description": "PowerControl plugin.", "scripts": { "build": "shx rm -rf dist && rollup -c", diff --git a/src/util/patch.ts b/src/util/patch.ts index 1c8e248..9acd6ca 100755 --- a/src/util/patch.ts +++ b/src/util/patch.ts @@ -100,28 +100,34 @@ class TDPPatch { }; public setTDP(tdp: number) { - this.perfStore.msgSettingsPerApp.tdp_limit = tdp; + if (this.perfStore?.msgSettingsPerApp?.tdp_limit) { + this.perfStore.msgSettingsPerApp.tdp_limit = tdp; + } } public setTDPEanble(isEnable: boolean) { - this.perfStore.msgSettingsPerApp.is_tdp_limit_enabled = isEnable; + if (this.perfStore?.msgSettingsPerApp?.is_tdp_limit_enabled) { + this.perfStore.msgSettingsPerApp.is_tdp_limit_enabled = isEnable; + } } public setTDPRange(min?: number, max?: number) { - if (min && this.perfStore.msgLimits.tdp_limit_min != undefined) { + if (min && this.perfStore?.msgLimits?.tdp_limit_min) { this.perfStore.msgLimits.tdp_limit_min = min; } - if (max && this.perfStore.msgLimits.tdp_limit_max != undefined) { + if (max && this.perfStore?.msgLimits?.tdp_limit_max) { this.perfStore.msgLimits.tdp_limit_max = max; } } private get active_profile_game_id() { - return this.perfStore.m_msgState.active_profile_game_id; + return this.perfStore?.m_msgState?.active_profile_game_id; } private set active_profile_game_id(game_id: string) { - this.perfStore.m_msgState.active_profile_game_id = game_id; + if (this.perfStore.m_msgState.active_profile_game_id) { + this.perfStore.m_msgState.active_profile_game_id = game_id; + } } private get current_game_id() {