From 1c39b64339b7313265fef8ab85fd12511bc9be51 Mon Sep 17 00:00:00 2001 From: jacques Date: Mon, 2 Sep 2024 17:17:54 +0200 Subject: [PATCH] Add non null assertion --- .../java/net/foucry/pilldroid/CustomScannerActivity.java | 3 ++- .../main/java/net/foucry/pilldroid/DrugListActivity.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java index fec670d..8938e9e 100644 --- a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java @@ -93,7 +93,7 @@ public class CustomScannerActivity extends AppCompatActivity implements Decorate } @Override - protected void onSaveInstanceState(Bundle outState) { + protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); capture.onSaveInstanceState(outState); } @@ -140,6 +140,7 @@ public class CustomScannerActivity extends AppCompatActivity implements Decorate @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); capture.onRequestPermissionsResult(requestCode, permissions, grantResults); } diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java index 930a236..ff89bc9 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java @@ -794,9 +794,13 @@ public class DrugListActivity extends AppCompatActivity { // }); Button btn_export = findViewById(R.id.switch_btn_export); + assert btn_export != null; Button btn_import = findViewById(R.id.switch_btn_import); + assert btn_import != null; Button btn_properties = findViewById(R.id.btn_properties); + assert btn_properties != null; Button btn_backupLocation = findViewById(R.id.btn_backup_location); + assert btn_backupLocation != null; encryptBackup = sharedPreferences.getBoolean(spEncryptBackup, true); storageLocation = sharedPreferences.getInt(spStorageLocation, 1); @@ -868,7 +872,7 @@ public class DrugListActivity extends AppCompatActivity { Log.i(TAG, "ok button"); - PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(this); + PrescriptionDatabase.getInstanceDatabase(this); final RoomBackup roomBackup = new RoomBackup(DrugListActivity.this); if (btn_export.isEnabled()) { btn_export.setOnClickListener(v -> {