check for null context in wizarddialog
This commit is contained in:
parent
65ea11d9a8
commit
9f9d348c11
1 changed files with 39 additions and 32 deletions
|
@ -26,6 +26,8 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -51,6 +53,7 @@ import info.nightscout.utils.SafeParse;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
public class WizardDialog extends DialogFragment implements OnClickListener {
|
public class WizardDialog extends DialogFragment implements OnClickListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(WizardDialog.class);
|
||||||
|
|
||||||
Button wizardDialogDeliverButton;
|
Button wizardDialogDeliverButton;
|
||||||
TextView correctionInput;
|
TextView correctionInput;
|
||||||
|
@ -208,6 +211,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
|
||||||
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
|
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
|
||||||
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
|
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||||
|
|
||||||
|
if (parentContext != null) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||||
builder.setMessage(confirmMessage);
|
builder.setMessage(confirmMessage);
|
||||||
|
@ -242,6 +246,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
|
||||||
builder.setNegativeButton(getString(R.string.cancel), null);
|
builder.setNegativeButton(getString(R.string.cancel), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
dismiss();
|
dismiss();
|
||||||
|
} else {
|
||||||
|
log.error("parentContext == null");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue