NSCv1: catch misformatted devicestatus
This commit is contained in:
parent
ff0d327a15
commit
4dde47bc44
|
@ -524,7 +524,11 @@ class NSClientService : DaggerService() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val devicestatuses = gson.fromJson(data.getString("devicestatus"), Array<NSDeviceStatus>::class.java)
|
val devicestatuses = try {
|
||||||
|
gson.fromJson(data.getString("devicestatus"), Array<NSDeviceStatus>::class.java)
|
||||||
|
} catch (unused: Exception) {
|
||||||
|
emptyArray<NSDeviceStatus>()
|
||||||
|
}
|
||||||
if (devicestatuses.isNotEmpty()) {
|
if (devicestatuses.isNotEmpty()) {
|
||||||
rxBus.send(EventNSClientNewLog("◄ DATA", "received " + devicestatuses.size + " device statuses"))
|
rxBus.send(EventNSClientNewLog("◄ DATA", "received " + devicestatuses.size + " device statuses"))
|
||||||
nsDeviceStatusHandler.handleNewData(devicestatuses)
|
nsDeviceStatusHandler.handleNewData(devicestatuses)
|
||||||
|
|
Loading…
Reference in a new issue