Fix global search would fail if last message had no peer

This commit is contained in:
Lonami Exo 2020-10-01 13:18:54 +02:00
parent 4683e83287
commit 233daafd96

View File

@ -240,7 +240,11 @@ class _MessagesIter(RequestIter):
self.request.offset_date = last_message.date self.request.offset_date = last_message.date
if isinstance(self.request, functions.messages.SearchGlobalRequest): if isinstance(self.request, functions.messages.SearchGlobalRequest):
if last_message.input_chat:
self.request.offset_peer = last_message.input_chat self.request.offset_peer = last_message.input_chat
else:
self.request.offset_peer = types.InputPeerEmpty()
self.request.offset_rate = getattr(response, 'next_rate', None) self.request.offset_rate = getattr(response, 'next_rate', None)