diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/xdrip/XdripPlugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/xdrip/XdripPlugin.kt index c2a5d9a91f..b683422596 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/xdrip/XdripPlugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/xdrip/XdripPlugin.kt @@ -362,10 +362,8 @@ class XdripPlugin @Inject constructor( private fun sendEntries(dataPairs: List, progress: String) { val array = JSONArray() - for (dataPair in dataPairs) { - val data = (dataPair as DataSyncSelector.PairGlucoseValue).value.toXdripJson() - array.put(data) - } + for (dataPair in dataPairs) + (dataPair as DataSyncSelector.PairGlucoseValue?)?.value?.toXdripJson()?.also { gv -> array.put(gv) } rxBus.send(EventXdripNewLog("SENDING", "Sent ${array.length()} BGs ($progress)")) broadcast( Intent(Intents.ACTION_NEW_SGV)