mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
TelegramClient: move the _sender null check to RequestWithDcMigration()
The method IsPhoneRegisteredAsync() was calling RequestWithDcMigration() which was the real method that made use of the _sender field, so we can move the null check to there. This will also help track down possible NullReferenceExceptions that could happen when other callers of this method arrive with a bad _sender, which might aid us trying to fix #706.
This commit is contained in:
parent
fe2baf5110
commit
4ce0f72d6d
|
|
@ -111,6 +111,9 @@ namespace TLSharp.Core
|
|||
|
||||
private async Task RequestWithDcMigration(TLMethod request)
|
||||
{
|
||||
if (_sender == null)
|
||||
throw new InvalidOperationException("Not connected!");
|
||||
|
||||
var completed = false;
|
||||
while(!completed)
|
||||
{
|
||||
|
|
@ -139,9 +142,6 @@ namespace TLSharp.Core
|
|||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
if (_sender == null)
|
||||
throw new InvalidOperationException("Not connected!");
|
||||
|
||||
var authCheckPhoneRequest = new TLRequestCheckPhone() { PhoneNumber = phoneNumber };
|
||||
|
||||
await RequestWithDcMigration(authCheckPhoneRequest);
|
||||
|
|
|
|||
Loading…
Reference in a new issue