Skip to content

Commit 8a183e2

Browse files
committed
Fix null handling in OuraRingConfigurationConverter
1 parent 06a33af commit 8a183e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

oura-library/src/main/kotlin/org/radarbase/oura/converter/OuraRingConfigurationConverter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class OuraRingConfigurationConverter(
4646
time = System.currentTimeMillis() / 1000.0
4747
timeReceived = System.currentTimeMillis() / 1000.0
4848
id = data.get("id")?.textValue()
49-
color = data.get("color")?.textValue()?.classifyColor()
50-
design = data.get("design")?.textValue()?.classifyDesign()
49+
color = data.get("color")?.textValue()?.classifyColor() ?: OuraRingColor.UNKNOWN
50+
design = data.get("design")?.textValue()?.classifyDesign() ?: OuraRingDesign.UNKNOWN
5151
firmwareVersion = data.get("firmware_version")?.textValue()
52-
hardwareType = data.get("hardware_type")?.textValue()?.classifyHardware()
53-
setUpAt = setupTime?.toEpochMilli()?.let { it / 1000.0 }
52+
hardwareType = data.get("hardware_type")?.textValue()?.classifyHardware() ?: OuraRingHardwareType.UNKNOWN
53+
setUpAt = setupTime?.toEpochMilli()?.let { it / 1000.0 }
5454
size = data.get("size")?.intValue()
5555
}.build()
5656
}

0 commit comments

Comments
 (0)