diff --git a/src/helpers/updateCheckPolicy.js b/src/helpers/updateCheckPolicy.js index 5c2698f39..34f5b9993 100644 --- a/src/helpers/updateCheckPolicy.js +++ b/src/helpers/updateCheckPolicy.js @@ -3,7 +3,9 @@ // firewalled machines never surface a connection error dialog (#1605). // Only an explicit false disables — missing prefs (renderer sync not arrived // yet) keep check-by-default behavior. -function appUpdatesEnabled({ notificationsEnabled, notifyUpdates } = {}) { +function appUpdatesEnabled(prefs = {}) { + const { notificationsEnabled, notifyUpdates } = + prefs && typeof prefs === "object" ? prefs : {}; return notificationsEnabled !== false && notifyUpdates !== false; } diff --git a/test/helpers/updateCheckPolicy.test.js b/test/helpers/updateCheckPolicy.test.js index e564f269e..0ef2f7b70 100644 --- a/test/helpers/updateCheckPolicy.test.js +++ b/test/helpers/updateCheckPolicy.test.js @@ -25,6 +25,9 @@ test("checks stay enabled by default before renderer prefs arrive", async () => // Same tri-state convention as the other notification prefs: only an // explicit false disables; missing prefs keep check-by-default behavior. assert.equal(appUpdatesEnabled(undefined), true); + assert.equal(appUpdatesEnabled(null), true); assert.equal(appUpdatesEnabled({}), true); + assert.equal(appUpdatesEnabled("invalid"), true); + assert.equal(appUpdatesEnabled(123), true); assert.equal(appUpdatesEnabled({ notificationsEnabled: true, notifyUpdates: true }), true); });