Skip to content

Commit fdea70b

Browse files
Merge pull request #3633 from dimagi/ci-575-form-filling-crash
CI-575 - Solved form crash
2 parents 4434f54 + 00c137c commit fdea70b

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

app/src/org/commcare/activities/FormEntryActivity.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public class FormEntryActivity extends SaveSessionCommCareActivity<FormEntryActi
146146
private SecretKeySpec symetricKey = null;
147147

148148
public static AndroidFormController mFormController;
149+
private static volatile boolean isFormEntryActive = false;
149150

150151
private boolean mIncompleteEnabled = true;
151152
private boolean instanceIsReadOnly = false;
@@ -1027,6 +1028,7 @@ private void restorePriorStates() {
10271028

10281029
private void loadForm() {
10291030
mFormController = null;
1031+
isFormEntryActive = false;
10301032
instanceState.setFormRecordPath(null);
10311033
InterruptedFormState savedFormSession = null;
10321034

@@ -1131,6 +1133,7 @@ private void handleFormLoadCompletion(AndroidFormController fc) {
11311133
}
11321134

11331135
mFormController = fc;
1136+
isFormEntryActive = true;
11341137
FirebaseAnalyticsUtil.reportFormEntry(getCurrentFormXmlnsFailSafe());
11351138

11361139
// Newer menus may have already built the menu, before all data was ready
@@ -1253,7 +1256,7 @@ protected void onDestroy() {
12531256
}
12541257

12551258
if (!isChangingConfigurations()) {
1256-
mFormController = null;
1259+
isFormEntryActive = false;
12571260
}
12581261

12591262
TextToSpeechConverter.INSTANCE.shutDown();
@@ -1722,4 +1725,8 @@ public CommCareActivityUIController getUIController() {
17221725
public SecretKeySpec getSymetricKey() {
17231726
return symetricKey;
17241727
}
1728+
1729+
public static boolean isFormEntryInProgress() {
1730+
return isFormEntryActive;
1731+
}
17251732
}

app/src/org/commcare/utils/GlobalErrorUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class GlobalErrorUtil {
1313
private static final int ERROR_EXPIRATION_HOURS = 24;
1414

1515
public static boolean triggerGlobalError(GlobalErrors error) {
16-
if (FormEntryActivity.mFormController != null) {
16+
if (FormEntryActivity.isFormEntryInProgress()) {
1717
return false;
1818
}
1919

0 commit comments

Comments
 (0)