From 9533f7b0b97261f87803c8f4457713fc5b232e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 13 Oct 2021 19:47:49 +0200 Subject: [PATCH] Don't setValue() if that would lead to setting a null/undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/settings/handlers/AccountSettingsHandler.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/settings/handlers/AccountSettingsHandler.ts b/src/settings/handlers/AccountSettingsHandler.ts index 5afe50e4e9..9ae3176fb8 100644 --- a/src/settings/handlers/AccountSettingsHandler.ts +++ b/src/settings/handlers/AccountSettingsHandler.ts @@ -118,8 +118,10 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa if (value === null || value === undefined) { const oldCombinedValue = settings["autoplayGifsAndVideos"]; // Write, so that we can remove this in the future - this.setValue("autoplayGifs", roomId, oldCombinedValue); - this.setValue("autoplayVideo", roomId, oldCombinedValue); + if (oldCombinedValue !== null && oldCombinedValue !== undefined) { + this.setValue("autoplayGifs", roomId, oldCombinedValue); + this.setValue("autoplayVideo", roomId, oldCombinedValue); + } return oldCombinedValue; } return value;