Fixed crash if LogManager fails to start (FIXES #196)

This commit is contained in:
Graham Jones
2024-06-14 14:46:52 +01:00
parent 1816c10234
commit e641f27829
4 changed files with 13 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
OpenSeizureDetector Android App - Change Log
============================================
V4.2.10 - fixed (infrequent) crash when opening data sharing page.
V4.2.10 - fixed (infrequent) crash when opening data sharing page (#195), and crash if log manager fails to start (#196)
V4.2.9 - fixed crash when using Polish translation.
V4.2.8 -
- Fixed crash in export data function when using european style comma based decimal separator.

View File

@@ -381,9 +381,15 @@ public class LogManager {
values.put("notes", desc);
values.put("dataJSON", dataJSON);
long newRowId = mOsdDb.insert(mEventsTableName, null, values);
Log.d(TAG, "createLocalEvent(): Created Row ID" + newRowId);
return true;
if (mOsdDb != null) {
long newRowId = mOsdDb.insert(mEventsTableName, null, values);
Log.d(TAG, "createLocalEvent(): Created Row ID" + newRowId);
return true;
} else {
Log.e(TAG,"createLocalEvent() - mOsdDb is null");
mUtil.showToast(mContext.getString(R.string.error_failed_to_create_local_event));
return false;
}
}
/**

View File

@@ -219,7 +219,7 @@ public class LogManagerControlActivity extends AppCompatActivity {
});
} else {
Log.e(TAG,"ERROR: initialiseServiceConnection() - mLm is null");
mUtil.showToast("ERROR: Failed to start Log Manager");
mUtil.showToast(getString(R.string.error_failed_to_start_log_manager));
}
}

View File

@@ -576,4 +576,6 @@
<string name="BTpermissions_required">Bluetooth Permissions Required</string>
<string name="BT_permissions_rationale">Bluetooth permissions are required to communicate with the bluetooth (BLE) data source</string>
<string name="restart_server">Restart Server</string>
<string name="error_failed_to_create_local_event">ERROR: failed to create local event</string>
<string name="error_failed_to_start_log_manager">ERROR: Failed to start Log Manager</string>
</resources>