Close buffered_file only if it exists

This commit is contained in:
Davte 2019-07-21 17:45:39 +02:00
parent 04827b4691
commit f5c661925c

View File

@ -1274,7 +1274,8 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
document = buffered_file document = buffered_file
except FileNotFoundError: except FileNotFoundError:
document = None document = None
buffered_file.close() if buffered_file:
buffered_file.close()
else: else:
use_stored_file_id = False use_stored_file_id = False
if document is None: if document is None: