Queer European MD passionate about IT
Explorar o código

Close buffered_file only if it exists

Davte %!s(int64=5) %!d(string=hai) anos
pai
achega
ad5ec33869
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      davtelepot/bot.py

+ 2 - 1
davtelepot/bot.py

@@ -1310,7 +1310,8 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
                         ['path']
                     )
         finally:
-            buffered_file.close()
+            if buffered_file:
+                buffered_file.close()
         if (
             type(sent_update) is dict
             and 'document' in sent_update