check for NPE in posted dialogs

This commit is contained in:
Milos Kozak 2017-09-23 20:12:53 +02:00
parent 2972b48d5a
commit b3bcb778e0
5 changed files with 5 additions and 5 deletions

View file

@ -180,7 +180,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
} catch (WindowManager.BadTokenException e) {
} catch (WindowManager.BadTokenException | NullPointerException e) {
// window has been destroyed
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));

View file

@ -112,7 +112,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
builder.setMessage(result.comment);
builder.setPositiveButton(context.getString(R.string.ok), null);
builder.show();
} catch (WindowManager.BadTokenException e) {
} catch (WindowManager.BadTokenException | NullPointerException e) {
// window has been destroyed
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));

View file

@ -127,7 +127,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
} catch (WindowManager.BadTokenException e) {
} catch (WindowManager.BadTokenException | NullPointerException e) {
// window has been destroyed
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));

View file

@ -367,7 +367,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
} catch (WindowManager.BadTokenException e) {
} catch (WindowManager.BadTokenException | NullPointerException e) {
// window has been destroyed
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));

View file

@ -713,7 +713,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
} catch (WindowManager.BadTokenException e) {
} catch (WindowManager.BadTokenException | NullPointerException e) {
// window has been destroyed
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));