1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-09 11:41:29 +00:00

Fix crash on start after improper shutdown (fixes #16).

This commit is contained in:
Felix Ableitner 2014-06-03 17:47:14 +02:00
parent d524461634
commit 19123506cc
2 changed files with 5 additions and 3 deletions

View file

@ -28,7 +28,7 @@ public class PostTask extends AsyncTask<String, Void, Void> {
* params[0] Syncthing hostname
* params[1] URI to call
* params[2] Syncthing API key
* params[3] The request content
* params[3] The request content (optional)
*/
@Override
protected Void doInBackground(String... params) {
@ -39,7 +39,9 @@ public class PostTask extends AsyncTask<String, Void, Void> {
post.addHeader(new BasicHeader("X-API-Key", params[2]));
try {
if (params.length > 2) {
post.setEntity(new StringEntity(params[3]));
}
httpclient.execute(post);
}
catch (IOException e) {

View file

@ -157,7 +157,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
* Restarts the syncthing binary.
*/
public void restart() {
new PostTask().execute(mUrl, PostTask.URI_RESTART, "");
new PostTask().execute(mUrl, PostTask.URI_RESTART);
}
/**