diff --git a/app/src/main/java/org/dhis2/usescases/settings/SyncManagerFragment.java b/app/src/main/java/org/dhis2/usescases/settings/SyncManagerFragment.java
index 01123525d9..d08a0b7c1e 100644
--- a/app/src/main/java/org/dhis2/usescases/settings/SyncManagerFragment.java
+++ b/app/src/main/java/org/dhis2/usescases/settings/SyncManagerFragment.java
@@ -292,8 +292,10 @@ public void deleteLocalData() {
                         getString(R.string.action_accept),
                         true,
                         () -> {
-                            analyticsHelper().setEvent(CONFIRM_DELETE_LOCAL_DATA, CLICK, CONFIRM_DELETE_LOCAL_DATA);
-                            presenter.deleteLocalData();
+                            if (deleteLocalDataDialog.isAdded()) {
+                                analyticsHelper().setEvent(CONFIRM_DELETE_LOCAL_DATA, CLICK, CONFIRM_DELETE_LOCAL_DATA);
+                                presenter.deleteLocalData();
+                            }
                             return null;
                         })
         );