From 816b0bdf9feec17c3431b67708f5d226e0214ed3 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 21 Jul 2023 22:48:12 +0200 Subject: [PATCH] Fix _get_thumb failed when document had no thumbs --- telethon/client/downloads.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index d7ae5a9c..3a1d4685 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -741,6 +741,9 @@ class DownloadMethods: @staticmethod def _get_thumb(thumbs, thumb): + if not thumbs: + return None + # Seems Telegram has changed the order and put `PhotoStrippedSize` # last while this is the smallest (layer 116). Ensure we have the # sizes sorted correctly with a custom function.