check for NPE

This commit is contained in:
Milos Kozak 2019-04-07 23:47:53 +02:00
parent e8b46e7880
commit a076b00363

View file

@ -496,6 +496,10 @@ public class IobCobCalculatorPlugin extends PluginBase {
log.debug("AUTOSENSDATA null: Exception catched (" + reason + ")"); log.debug("AUTOSENSDATA null: Exception catched (" + reason + ")");
return null; return null;
} }
if (data == null) {
log.debug("AUTOSENSDATA null: data==null");
return null;
}
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) { if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
if (L.isEnabled(L.AUTOSENS)) if (L.isEnabled(L.AUTOSENS))
log.debug("AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time)); log.debug("AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time));