Skip to content

Commit

Permalink
fixes #7
Browse files Browse the repository at this point in the history
LoadingDialogs can crash when the listener is no longer connected when
the button is pressed, e.g. when the device was rotated directly after
button press.

Signed-off-by: x0b <[email protected]>
  • Loading branch information
x0b committed Oct 1, 2019
1 parent 6a43346 commit b7ad573
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,18 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
builder.setNegativeButton(negativeText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onNegativeListener.onNegative();
if(null != onNegativeListener) {
onNegativeListener.onNegative();
}
}
});
} else if (negativeTextId > 0) {
builder.setNeutralButton(negativeTextId, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onNegativeListener.onNegative();
if(null != onNegativeListener) {
onNegativeListener.onNegative();
}
}
});
}
Expand Down

0 comments on commit b7ad573

Please sign in to comment.