From 02c5b4137a6f4fdd322479dc5b09f589911e5335 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Apr 2022 22:07:04 +0200 Subject: [PATCH] Fix NullRef when RPC result is a nullable TL type --- .github/dev.yml | 2 +- EXAMPLES.md | 5 ++++- README.md | 3 ++- src/Client.cs | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e3453ef..b7e4492 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.3.1-dev.$(Rev:r) +name: 2.3.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ba16c86..2b5d63f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -352,12 +352,15 @@ client.TcpHandler = async (address, port) => }; ``` -MTProxy (MTProto proxy) can be used to prevent ISP blocks, through the `client.MTProxyUrl` property: +MTProxy (MTProto proxy) can be used to prevent ISP blocking Telegram servers, through the `client.MTProxyUrl` property: ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.MTProxyUrl = "http://t.me/proxy?server=...&port=...&secret=..."; var myself = await client.LoginUserIfNeeded(); ``` +You can find a list of working MTProxies in channels like [@ProxyMTProto](https://t.me/ProxyMTProto) or [@MTProxyT](https://t.me/MTProxyT) *(right-click the "Connect" buttons)* +If your Telegram client is already connected to such MTPROTO proxy, you can also export its URL by clicking on the shield button ![🛡](https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/icons/proxy_on.png) and then **⋮** > **Share** + *Note: WTelegramClient always uses transport obfuscation when connecting to Telegram servers, even without MTProxy* diff --git a/README.md b/README.md index 731684a..1b794d9 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,11 @@ ## _Telegram Client API library written 100% in C# and .NET Standard_ -This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. This library allows you to connect to Telegram and control a user programmatically (or a bot, but [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) is much easier for that). All the Telegram Client APIs are supported so you can do everything the user could do with a full Telegram GUI client. +This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. + >⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. >If you are a beginner in C#, starting a project based on this library might not be a great idea. diff --git a/src/Client.cs b/src/Client.cs index ba174f4..f9335e0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1109,6 +1109,7 @@ namespace WTelegram var result = await rpc.Task; switch (result) { + case null: return default; case T resultT: return resultT; case RpcError { error_code: var code, error_message: var message }: int x = -1;