check for null context in wizarddialog

This commit is contained in:
Milos Kozak 2016-08-27 12:32:18 +02:00
parent 65ea11d9a8
commit 9f9d348c11

View file

@ -26,6 +26,8 @@ import android.widget.TextView;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -51,6 +53,7 @@ import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
public class WizardDialog extends DialogFragment implements OnClickListener {
private static Logger log = LoggerFactory.getLogger(WizardDialog.class);
Button wizardDialogDeliverButton;
TextView correctionInput;
@ -208,6 +211,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
if (parentContext != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(confirmMessage);
@ -242,6 +246,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
builder.setNegativeButton(getString(R.string.cancel), null);
builder.show();
dismiss();
} else {
log.error("parentContext == null");
}
}
break;
}