Skip to content

Commit 8d4b484

Browse files
Eldinnietsnoam
authored andcommitted
Fix Game.to_dict() (python-telegram-bot#767)
`Game.to_dict()` fails if the `optional` parameter `test_entities` has it's default value `None` This fixes that.
1 parent 073bed3 commit 8d4b484

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

telegram/games/game.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def to_dict(self):
8888
data = super(Game, self).to_dict()
8989

9090
data['photo'] = [p.to_dict() for p in self.photo]
91-
data['text_entities'] = [x.to_dict() for x in self.text_entities]
91+
if self.text_entities:
92+
data['text_entities'] = [x.to_dict() for x in self.text_entities]
9293

9394
return data
9495

0 commit comments

Comments
 (0)