Fix NPE
This commit is contained in:
parent
d0fb2fd0e9
commit
8c02daf39d
|
@ -1437,7 +1437,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
QueryBuilder<CareportalEvent, Long> queryBuilder = getDaoCareportalEvents().queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
Where where = queryBuilder.where();
|
||||
where.ge("date", mills).and().isNotNull("json");
|
||||
where.ge("date", mills).and().isNotNull("json").and().isNotNull("eventType");
|
||||
PreparedQuery<CareportalEvent> preparedQuery = queryBuilder.prepare();
|
||||
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
|
||||
preprocessOpenAPSOfflineEvents(careportalEvents);
|
||||
|
@ -1454,7 +1454,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
QueryBuilder<CareportalEvent, Long> queryBuilder = getDaoCareportalEvents().queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
Where where = queryBuilder.where();
|
||||
where.between("date", start, end);
|
||||
where.between("date", start, end).and().isNotNull("json").and().isNotNull("eventType");
|
||||
PreparedQuery<CareportalEvent> preparedQuery = queryBuilder.prepare();
|
||||
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
|
||||
preprocessOpenAPSOfflineEvents(careportalEvents);
|
||||
|
@ -1481,7 +1481,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
QueryBuilder<CareportalEvent, Long> queryBuilder = getDaoCareportalEvents().queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
Where where = queryBuilder.where();
|
||||
where.ge("date", mills).and().eq("eventType", type);
|
||||
where.ge("date", mills).and().eq("eventType", type).and().isNotNull("json");
|
||||
PreparedQuery<CareportalEvent> preparedQuery = queryBuilder.prepare();
|
||||
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
|
||||
preprocessOpenAPSOfflineEvents(careportalEvents);
|
||||
|
@ -1497,6 +1497,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
List<CareportalEvent> careportalEvents;
|
||||
QueryBuilder<CareportalEvent, Long> queryBuilder = getDaoCareportalEvents().queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
Where where = queryBuilder.where();
|
||||
where.isNotNull("json").and().isNotNull("eventType");
|
||||
PreparedQuery<CareportalEvent> preparedQuery = queryBuilder.prepare();
|
||||
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
|
||||
preprocessOpenAPSOfflineEvents(careportalEvents);
|
||||
|
|
|
@ -1183,23 +1183,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
final ExtendedBolus extendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
String extendedBolusText = "";
|
||||
if (extendedBolusView != null) { // must not exists in all layouts
|
||||
if (shorttextmode) {
|
||||
if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses()) {
|
||||
extendedBolusText = DecimalFormatter.to2Decimal(extendedBolus.absoluteRate()) + "U/h";
|
||||
}
|
||||
} else {
|
||||
if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses()) {
|
||||
extendedBolusText = extendedBolus.toStringMedium();
|
||||
}
|
||||
}
|
||||
if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses())
|
||||
extendedBolusText = shorttextmode ? DecimalFormatter.to2Decimal(extendedBolus.absoluteRate()) + "U/h" : extendedBolus.toStringMedium();
|
||||
extendedBolusView.setText(extendedBolusText);
|
||||
extendedBolusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.extended_bolus), extendedBolus.toString()));
|
||||
if (extendedBolusText.equals("")) {
|
||||
extendedBolusLayout.setVisibility(View.GONE);
|
||||
if (extendedBolusLayout != null) extendedBolusView.setVisibility(Config.NSCLIENT ? View.INVISIBLE : View.GONE);
|
||||
} else {
|
||||
extendedBolusView.setVisibility(View.VISIBLE);
|
||||
if (extendedBolusLayout != null) extendedBolusLayout.setVisibility(View.VISIBLE);
|
||||
extendedBolusView.setOnClickListener(v -> {
|
||||
if (extendedBolus != null)
|
||||
OKDialog.show(getActivity(), MainApp.gs(R.string.extended_bolus), extendedBolus.toString());
|
||||
});
|
||||
// hide whole line for APS mode
|
||||
if (extendedBolusLayout != null) {
|
||||
if (extendedBolusText.equals(""))
|
||||
extendedBolusLayout.setVisibility(View.GONE);
|
||||
else
|
||||
extendedBolusLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue