1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-22 20:31:16 +00:00

FolderActivity - fix NPE - don't update if removed (fixes #1143)

This commit is contained in:
Catfriend1 2018-06-16 15:25:36 +02:00 committed by Audrius Butkevicius
parent 3cb13b68f5
commit 2b360dab54

View file

@ -29,6 +29,7 @@ import com.google.gson.Gson;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.model.Device;
import com.nutomic.syncthingandroid.model.Folder;
import com.nutomic.syncthingandroid.service.RestApi;
import com.nutomic.syncthingandroid.service.SyncthingService;
import com.nutomic.syncthingandroid.util.TextWatcherAdapter;
import com.nutomic.syncthingandroid.util.Util;
@ -85,7 +86,7 @@ public class FolderActivity extends SyncthingActivity
private TextView mEditIgnores;
private boolean mIsCreateMode;
private boolean mFolderNeedsToUpdate;
private boolean mFolderNeedsToUpdate = false;
private Dialog mDeleteDialog;
private Dialog mDiscardDialog;
@ -403,7 +404,11 @@ public class FolderActivity extends SyncthingActivity
return new AlertDialog.Builder(this)
.setMessage(R.string.remove_folder_confirm)
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
getApi().removeFolder(mFolder.id);
RestApi restApi = getApi();
if (restApi != null) {
restApi.removeFolder(mFolder.id);
}
mFolderNeedsToUpdate = false;
finish();
})
.setNegativeButton(android.R.string.no, null)