KeepAliveReceiver: check pump only if initialized already.

This commit is contained in:
Johannes Mockenhaupt 2017-10-27 19:39:51 +02:00
parent eed3773b49
commit a1d6834bce
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -56,7 +56,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
private void checkPump() { private void checkPump() {
final PumpInterface pump = MainApp.getConfigBuilder(); final PumpInterface pump = MainApp.getConfigBuilder();
final Profile profile = MainApp.getConfigBuilder().getProfile(); final Profile profile = MainApp.getConfigBuilder().getProfile();
if (pump != null && profile != null && profile.getBasal() != null) { if (pump != null && pump.isInitialized() && profile != null && profile.getBasal() != null) {
Date lastConnection = pump.lastDataTime(); Date lastConnection = pump.lastDataTime();
boolean isStatusOutdated = lastConnection.getTime() + 15 * 60 * 1000L < System.currentTimeMillis(); boolean isStatusOutdated = lastConnection.getTime() + 15 * 60 * 1000L < System.currentTimeMillis();