Don't setValue() if that would lead to setting a null/undefined

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-10-13 19:47:49 +02:00
parent bc336abf47
commit 9533f7b0b9
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D

View file

@ -118,8 +118,10 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
if (value === null || value === undefined) { if (value === null || value === undefined) {
const oldCombinedValue = settings["autoplayGifsAndVideos"]; const oldCombinedValue = settings["autoplayGifsAndVideos"];
// Write, so that we can remove this in the future // Write, so that we can remove this in the future
this.setValue("autoplayGifs", roomId, oldCombinedValue); if (oldCombinedValue !== null && oldCombinedValue !== undefined) {
this.setValue("autoplayVideo", roomId, oldCombinedValue); this.setValue("autoplayGifs", roomId, oldCombinedValue);
this.setValue("autoplayVideo", roomId, oldCombinedValue);
}
return oldCombinedValue; return oldCombinedValue;
} }
return value; return value;