Skip to content

Commit

Permalink
Update guild.py (#7)
Browse files Browse the repository at this point in the history
* Update guild.py

Server currently returns None for guilds with no channels, which causes `TypeError: 'NoneType' object is not iterable`
Fix this by making the None returned by the server into an empty list, getting rid of the error

* Update guild.py

Fix TypeError on iterating through None
  • Loading branch information
DistortedPumpkin authored Aug 23, 2021
1 parent 1125f01 commit f50d795
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ferris/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def _process_data(self, data: Data, /) -> None:

self._channels: Dict[int, Channel] = {}

for c in data.get('channels', []):
for c in data.get('channels') or []:
channel = Channel(self._connection, c)
self._channels[channel.id] = channel

self._members: Dict[int, Member] = {}

for m in data.get('members', []):
for m in data.get('members') or []:
member = Member(self._connection, m)
self._members[member.id] = member

Expand Down

0 comments on commit f50d795

Please sign in to comment.