Xdrip: prevent NPE
This commit is contained in:
parent
75d34955b7
commit
8ce12d61c0
1 changed files with 2 additions and 4 deletions
|
@ -362,10 +362,8 @@ class XdripPlugin @Inject constructor(
|
||||||
|
|
||||||
private fun sendEntries(dataPairs: List<DataSyncSelector.DataPair>, progress: String) {
|
private fun sendEntries(dataPairs: List<DataSyncSelector.DataPair>, progress: String) {
|
||||||
val array = JSONArray()
|
val array = JSONArray()
|
||||||
for (dataPair in dataPairs) {
|
for (dataPair in dataPairs)
|
||||||
val data = (dataPair as DataSyncSelector.PairGlucoseValue).value.toXdripJson()
|
(dataPair as DataSyncSelector.PairGlucoseValue?)?.value?.toXdripJson()?.also { gv -> array.put(gv) }
|
||||||
array.put(data)
|
|
||||||
}
|
|
||||||
rxBus.send(EventXdripNewLog("SENDING", "Sent ${array.length()} BGs ($progress)"))
|
rxBus.send(EventXdripNewLog("SENDING", "Sent ${array.length()} BGs ($progress)"))
|
||||||
broadcast(
|
broadcast(
|
||||||
Intent(Intents.ACTION_NEW_SGV)
|
Intent(Intents.ACTION_NEW_SGV)
|
||||||
|
|
Loading…
Reference in a new issue