Close buffered_file only if it exists

This commit is contained in:
Davte 2019-07-26 10:36:30 +02:00
parent 80418bd11c
commit ad5ec33869

View File

@ -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