diff options
| author | Rapptz <[email protected]> | 2019-04-14 07:19:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-04-14 07:19:22 -0400 |
| commit | 9b089c9a7b5b3330765932e7ceca345e2fedfaf2 (patch) | |
| tree | 63de6ad617865ba4536f34cfc85c92326a3613de | |
| parent | Fix typo in on_raw_reaction_remove docs. (diff) | |
| download | discord.py-9b089c9a7b5b3330765932e7ceca345e2fedfaf2.tar.xz discord.py-9b089c9a7b5b3330765932e7ceca345e2fedfaf2.zip | |
Fix abc.GuildChannel.overwrites returning None keys.
This has potential for data loss as a consequence of how the function
works.
| -rw-r--r-- | discord/abc.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/discord/abc.py b/discord/abc.py index 86466d3d..015f38d2 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -365,7 +365,14 @@ class GuildChannel: target = self.guild.get_role(ow.id) elif ow.type == 'member': target = self.guild.get_member(ow.id) - ret[target] = overwrite + + # TODO: There is potential data loss here in the non-chunked + # case, i.e. target is None because get_member returned nothing. + # This can be fixed with a slight breaking change to the return type, + # i.e. adding discord.Object to the list of it + # However, for now this is an acceptable compromise. + if target is not None: + ret[target] = overwrite return ret @property |