Queer European MD passionate about IT
소스 검색

Close buffered_file only if it exists

Davte 5 년 전
부모
커밋
ad5ec33869
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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