Fix NullRef when RPC result is a nullable TL type

This commit is contained in:
Wizou 2022-04-18 22:07:04 +02:00
parent 9aa97d341a
commit 02c5b4137a
4 changed files with 8 additions and 3 deletions

2
.github/dev.yml vendored
View file

@ -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

View file

@ -352,12 +352,15 @@ client.TcpHandler = async (address, port) =>
};
```
<a name="mtproxy"></a>
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*
<a name="logging"></a>

View file

@ -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.

View file

@ -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;