Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6942 from SimonBrandner/fix/autoplay-setting
Browse files Browse the repository at this point in the history
Don't `setValue()` if that would lead to setting a `null`/`undefined`
  • Loading branch information
James Salter authored Oct 14, 2021
2 parents ea72576 + 9533f7b commit 1f7d07a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/settings/handlers/AccountSettingsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1f7d07a

Please sign in to comment.