Merge pull request #6942 from SimonBrandner/fix/autoplay-setting

Don't `setValue()` if that would lead to setting a `null`/`undefined`
This commit is contained in:
James Salter
2021-10-14 09:30:43 +01:00
committed by GitHub

View File

@@ -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;