Skip to content

Commit

Permalink
Fix crash on export/import (fixes #142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 committed Dec 18, 2018
1 parent 3659eb8 commit 73c5017
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
Expand Down Expand Up @@ -796,7 +797,14 @@ public boolean exportConfig() {

// Start syncthing after export if run conditions apply.
if (mLastDeterminedShouldRun) {
launchStartupTask(SyncthingRunnable.Command.main);
Handler mainLooper = new Handler(Looper.getMainLooper());
Runnable launchStartupTaskRunnable = new Runnable() {
@Override
public void run() {
launchStartupTask(SyncthingRunnable.Command.main);
}
};
mainLooper.post(launchStartupTaskRunnable);
}
return failSuccess;
}
Expand Down Expand Up @@ -952,7 +960,14 @@ public boolean importConfig() {

// Start syncthing after import if run conditions apply.
if (mLastDeterminedShouldRun) {
launchStartupTask(SyncthingRunnable.Command.main);
Handler mainLooper = new Handler(Looper.getMainLooper());
Runnable launchStartupTaskRunnable = new Runnable() {
@Override
public void run() {
launchStartupTask(SyncthingRunnable.Command.main);
}
};
mainLooper.post(launchStartupTaskRunnable);
}
return failSuccess;
}
Expand Down

0 comments on commit 73c5017

Please sign in to comment.