Skip to content
Snippets Groups Projects
Unverified Commit fa732ff8 authored by Johannes Mockenhaupt's avatar Johannes Mockenhaupt
Browse files

Hack: prevent crash on CNL disconnect and reconnect

parent a76774c2
No related branches found
No related tags found
No related merge requests found
......@@ -945,6 +945,9 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
private class UsbReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO move this somewhere else ... wherever it belongs
// realm might be closed ... sometimes occurs when USB is disconnected and replugged ...
if (mRealm.isClosed()) mRealm = Realm.getDefaultInstance();
String action = intent.getAction();
if (MedtronicCnlIntentService.Constants.ACTION_USB_PERMISSION.equals(action)) {
boolean permissionGranted = intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment