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:
parent
d524461634
commit
19123506cc
2 changed files with 5 additions and 3 deletions
|
@ -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 {
|
||||
post.setEntity(new StringEntity(params[3]));
|
||||
if (params.length > 2) {
|
||||
post.setEntity(new StringEntity(params[3]));
|
||||
}
|
||||
httpclient.execute(post);
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue