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