fix NPE
This commit is contained in:
parent
8ec3649cea
commit
cd90bab877
|
@ -3,10 +3,13 @@ package info.nightscout.androidaps.queue.commands;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.utils.LocalAlertUtils;
|
||||
import info.nightscout.utils.T;
|
||||
|
||||
/**
|
||||
* Created by mike on 09.11.2017.
|
||||
|
@ -29,8 +32,15 @@ public class CommandReadStatus extends Command {
|
|||
LocalAlertUtils.notifyPumpStatusRead();
|
||||
if (L.isEnabled(L.PUMPQUEUE))
|
||||
log.debug("CommandReadStatus executed. Reason: " + reason);
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
PumpEnactResult result = new PumpEnactResult().success(false);
|
||||
if (pump != null) {
|
||||
long lastConnection = pump.lastDataTime();
|
||||
if (lastConnection > System.currentTimeMillis() - T.mins(1).msecs())
|
||||
result.success(true);
|
||||
}
|
||||
if (callback != null)
|
||||
callback.result(null).run();
|
||||
callback.result(result).run();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue