Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when accessing TorControlConnection too early #56

Open
grote opened this issue Nov 25, 2021 · 2 comments
Open

NullPointerException when accessing TorControlConnection too early #56

grote opened this issue Nov 25, 2021 · 2 comments

Comments

@grote
Copy link
Contributor

grote commented Nov 25, 2021

When a user of TorService starts and binds to the service, then (as documented) tries to use the TorControlConnection, it can happen that it hasn't been assigned and a NullPointerException is thrown. This is because the TorControlConnection gets only assigned in another thread after doing some extra work.

How is a user of the library supposed to know when the control connection becomes available? Are they expected to register a broadcast receiver and wait for the TorService.STATUS_ON event? That would be quite a cumbersome, but possible solution. If it is that, it should at least get documented.

@grote
Copy link
Contributor Author

grote commented Nov 25, 2021

By chance, I just stumbled about this unconventional workaround in Orbot.

@n8fr8
Copy link
Member

n8fr8 commented Nov 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants