mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	Catch calling .receive() when .sender is None on recv_thread
This commit is contained in:
		
							parent
							
								
									12c12fdfaf
								
							
						
					
					
						commit
						05a8723d36
					
				| 
						 | 
					@ -1004,6 +1004,13 @@ class TelegramClient(TelegramBareClient):
 | 
				
			||||||
                    self._last_ping = datetime.now()
 | 
					                    self._last_ping = datetime.now()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                self._sender.receive(update_state=self.updates)
 | 
					                self._sender.receive(update_state=self.updates)
 | 
				
			||||||
 | 
					            except AttributeError:
 | 
				
			||||||
 | 
					                # 'NoneType' object has no attribute 'receive'.
 | 
				
			||||||
 | 
					                # The only moment when this can happen is reconnection
 | 
				
			||||||
 | 
					                # was triggered from another thread and the ._sender
 | 
				
			||||||
 | 
					                # was set to None, so close this thread and exit by return.
 | 
				
			||||||
 | 
					                self._recv_thread = None
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
            except TimeoutError:
 | 
					            except TimeoutError:
 | 
				
			||||||
                # No problem.
 | 
					                # No problem.
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user