Skip to content
Snippets Groups Projects
Commit 89ab4dd0 authored by Torsten Grote's avatar Torsten Grote
Browse files

Merge branch '665-android-executor-npe' into 'master'

Fix potential NPE in AndroidExecutorImpl

Always wait for the startup latch to ensure the background thread's Handler is initialised before using it.

Closes #665.

See merge request !319
parents bf023874 f3ea7315
No related branches found
No related tags found
No related merge requests found
...@@ -39,10 +39,11 @@ class AndroidExecutorImpl implements AndroidExecutor { ...@@ -39,10 +39,11 @@ class AndroidExecutorImpl implements AndroidExecutor {
} }
private void startIfNecessary() { private void startIfNecessary() {
if (started.getAndSet(true)) return; if (!started.getAndSet(true)) {
Thread t = new Thread(loop, "AndroidExecutor"); Thread t = new Thread(loop, "AndroidExecutor");
t.setDaemon(true); t.setDaemon(true);
t.start(); t.start();
}
try { try {
startLatch.await(); startLatch.await();
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment