Combo: fix ReadQuickInfoCommand to handle empty bolus history.

This commit is contained in:
Johannes Mockenhaupt 2018-06-18 20:17:51 +02:00
parent ef650b80a1
commit 3ed4aa468d
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -39,6 +39,7 @@ public class ReadQuickInfoCommand extends BaseCommand {
// read bolus records // read bolus records
int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD); int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD);
int record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD); int record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD);
if (record > 0) {
while (true) { while (true) {
bolusHistory.add(readBolusRecord()); bolusHistory.add(readBolusRecord());
if (bolusHistory.size() == numberOfBolusRecordsToRetrieve || record == totalRecords) { if (bolusHistory.size() == numberOfBolusRecordsToRetrieve || record == totalRecords) {
@ -51,6 +52,7 @@ public class ReadQuickInfoCommand extends BaseCommand {
} }
record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD); record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD);
} }
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
if (!result.history.bolusHistory.isEmpty()) { if (!result.history.bolusHistory.isEmpty()) {
log.debug("Read bolus history (" + result.history.bolusHistory.size() + "):"); log.debug("Read bolus history (" + result.history.bolusHistory.size() + "):");