tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Failed assertion: line 60 pos 12: '_client != null': is not true. #2878

Closed Mashi-91 closed 5 months ago

Mashi-91 commented 5 months ago

Showing this when creating a superGroupChannel

Screenshot 2024-05-10 200154

It work sometime when reload then run but after that it show this error Anyone?......

levlam commented 5 months ago

The assertion isn't from TDLib's source code.

Mashi-91 commented 5 months ago

can u tell me how i get the group data. and its not returning anything?

levlam commented 5 months ago

You never need to call getSupergroup, if you correctly handle updates. See https://core.telegram.org/tdlib/getting-started for more details.

Mashi-91 commented 5 months ago

updateSupergroup — This update is received whenever a new supergroup has been discovered or some data about a known supergroup has changed. This update is guaranteed to come before the supergroup identifier is returned to the Application. So, whenever an Application receives a supergroup_id, it never needs to use the

here i got this.. thnx

and one more thing

can i hide the channel like user can't see the channel?

levlam commented 5 months ago

What channel do you want to hide?

Mashi-91 commented 5 months ago

My own channel. Like I don't want to see this channel to user on their chat list.

Screenshot_2024-05-11-00-20-30-39_948cd9899890cbd5c2798760b2b95377.jpg

levlam commented 5 months ago

You can try to hide it only in your own app by implementing the hiding.

Mashi-91 commented 5 months ago

can u tell me how?

levlam commented 5 months ago

If you write your own app, then you can skip the chat.

Mashi-91 commented 5 months ago

Failed assertion: line 60 pos 12: '_client != null': is not true

only show this error when i use this function final result = await client!.send(tda.CreatePrivateChat(userId: chat.id,force: false));

Screenshot 2024-05-11 154151

After trigging this function showing this in log

D/DLTD ( 2099): [ 4][t 4][1715422449.157097101][MultiPromise.cpp:60] Set result for 1 promises in TdDbCloseMultiPromiseActor I/DLTD ( 2099): [ 3][t 4][1715422449.157102108][SqliteConnectionSafe.cpp:39] Close SQLite database [path:/data/data/com.example.cloudinfinity/app_flutter/CloudInfinity/db.sqlite] D/DLTD ( 2099): [ 4][t 2][1715422449.157632112][Td.cpp:3187][#7][!Td] Decrease reference count to 0 I/DLTD ( 2099): [ 3][t 2][1715422449.157644033][Td.cpp:4034][#7][!Td][&td_requests] Sending update: updateAuthorizationState { I/DLTD ( 2099): authorization_state = authorizationStateClosed { I/DLTD ( 2099): } I/DLTD ( 2099): }

Need Help Brother....

levlam commented 5 months ago

The bug is in your code. You closed the TDLib instance assigned null to the client variable, and then tried to access null object.

Mashi-91 commented 5 months ago

No bro, i already checked and Client is not null. I am getting everything except few functions by running those i am getting this error. Like GetMe function works fine

levlam commented 5 months ago

No, it is null. You checked that "Client is not null" only at the beginning of the function, but the function is asynchronous and client isn't a local variable. A lot of other code can run while the function is invoked, including one that closes the client and sets it to null.

Mashi-91 commented 5 months ago

If it's null then how does everything works the first time when trigger the function and not work second.. then again work after hot reload. 🤔

levlam commented 5 months ago

That's the question for the rest of your code.