From 28f10bd042eecd5f158b1cceedaa530c85e81a93 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 22 Feb 2018 11:03:48 +0100 Subject: [PATCH] Make sure it's a Contacts before accessing fields --- pyrogram/client/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 75804635..f2d987ae 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -2412,6 +2412,8 @@ class Client: time.sleep(e.x) continue else: - log.info("Contacts count: {}".format(len(contacts.users))) - self.fetch_peers(contacts.users) + if isinstance(contacts, types.contacts.Contacts): + log.info("Contacts count: {}".format(len(contacts.users))) + self.fetch_peers(contacts.users) + return contacts