mirror of https://github.com/jetkvm/kvm.git
bug: fix null pointer in wakeDisplay (#907)
This commit is contained in:
parent
204909b49a
commit
50fc88aae1
|
|
@ -305,11 +305,11 @@ func wakeDisplay(force bool, reason string) {
|
|||
displayLogger.Warn().Err(err).Msg("failed to wake display")
|
||||
}
|
||||
|
||||
if config.DisplayDimAfterSec != 0 {
|
||||
if config.DisplayDimAfterSec != 0 && dimTicker != nil {
|
||||
dimTicker.Reset(time.Duration(config.DisplayDimAfterSec) * time.Second)
|
||||
}
|
||||
|
||||
if config.DisplayOffAfterSec != 0 {
|
||||
if config.DisplayOffAfterSec != 0 && offTicker != nil {
|
||||
offTicker.Reset(time.Duration(config.DisplayOffAfterSec) * time.Second)
|
||||
}
|
||||
backlightState = 0
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ export default function SettingsHardwareRoute() {
|
|||
}
|
||||
|
||||
setBacklightSettings(settings);
|
||||
handleBacklightSettingsSave();
|
||||
handleBacklightSettingsSave(settings);
|
||||
};
|
||||
|
||||
const handleBacklightSettingsSave = () => {
|
||||
const handleBacklightSettingsSave = (backlightSettings: BacklightSettings) => {
|
||||
send("setBacklightSettings", { params: backlightSettings }, (resp: JsonRpcResponse) => {
|
||||
if ("error" in resp) {
|
||||
notifications.error(
|
||||
|
|
@ -81,7 +81,7 @@ export default function SettingsHardwareRoute() {
|
|||
const duration = enabled ? 90 : -1;
|
||||
send("setVideoSleepMode", { duration }, (resp: JsonRpcResponse) => {
|
||||
if ("error" in resp) {
|
||||
notifications.error(m.hardware_power_saving_failed_error({ error: resp.error.data ||m.unknown_error() }));
|
||||
notifications.error(m.hardware_power_saving_failed_error({ error: resp.error.data || m.unknown_error() }));
|
||||
setPowerSavingEnabled(!enabled); // Attempt to revert on error
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue