Skip to content

Commit 3832687

Browse files
committed
add input events sub check [ci skip]
1 parent 9c5341e commit 3832687

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

applications/services/desktop/desktop.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ static void desktop_stop_auto_lock_timer(Desktop* desktop) {
214214

215215
static void desktop_auto_lock_arm(Desktop* desktop) {
216216
if(desktop->settings.auto_lock_delay_ms) {
217-
desktop->input_events_subscription = furi_pubsub_subscribe(
218-
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
217+
if(!desktop->input_events_subscription) {
218+
desktop->input_events_subscription = furi_pubsub_subscribe(
219+
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
220+
}
219221
desktop_start_auto_lock_timer(desktop);
220222
}
221223
}
@@ -246,8 +248,10 @@ static void desktop_stop_auto_poweroff_timer(Desktop* desktop) {
246248

247249
static void desktop_auto_poweroff_arm(Desktop* desktop) {
248250
if(desktop->settings.auto_poweroff_delay_ms) {
249-
desktop->input_events_subscription = furi_pubsub_subscribe(
250-
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
251+
if(desktop->input_events_subscription) {
252+
desktop->input_events_subscription = furi_pubsub_subscribe(
253+
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
254+
}
251255
desktop_start_auto_poweroff_timer(desktop);
252256
}
253257
}

0 commit comments

Comments
 (0)