Added check that log manager mLm is not null before using it - FIXES #195 (well prevents it crashing the whole app anyway!)

This commit is contained in:
Graham Jones
2024-06-14 14:36:22 +01:00
parent 7871de926c
commit 1816c10234
3 changed files with 21 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
OpenSeizureDetector Android App - Change Log OpenSeizureDetector Android App - Change Log
============================================ ============================================
V4.2.10 - fixed (infrequent) crash when opening data sharing page.
V4.2.9 - fixed crash when using Polish translation. V4.2.9 - fixed crash when using Polish translation.
V4.2.8 - V4.2.8 -
- Fixed crash in export data function when using european style comma based decimal separator. - Fixed crash in export data function when using european style comma based decimal separator.

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:versionCode="143" android:versionCode="144"
android:versionName="4.2.9"> android:versionName="4.2.10">
<!-- android:allowBackup="false" --> <!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

View File

@@ -203,6 +203,7 @@ public class LogManagerControlActivity extends AppCompatActivity {
ProgressBar pb = (ProgressBar) findViewById(R.id.remoteAccessPb); ProgressBar pb = (ProgressBar) findViewById(R.id.remoteAccessPb);
pb.setIndeterminate(true); pb.setIndeterminate(true);
pb.setVisibility(View.VISIBLE); pb.setVisibility(View.VISIBLE);
if (mLm != null) {
// Populate events list - we only do it once when the activity is created because the query might slow down the UI. // Populate events list - we only do it once when the activity is created because the query might slow down the UI.
// We could try this code in updateUI() and see though. // We could try this code in updateUI() and see though.
// Based on https://www.tutlane.com/tutorial/android/android-sqlite-listview-with-examples // Based on https://www.tutlane.com/tutorial/android/android-sqlite-listview-with-examples
@@ -216,6 +217,10 @@ public class LogManagerControlActivity extends AppCompatActivity {
Log.v(TAG, "initialiseServiceConnection() - set mSysLogList - Updating UI"); Log.v(TAG, "initialiseServiceConnection() - set mSysLogList - Updating UI");
updateUi(); updateUi();
}); });
} else {
Log.e(TAG,"ERROR: initialiseServiceConnection() - mLm is null");
mUtil.showToast("ERROR: Failed to start Log Manager");
}
} }