Xiaomi: Fix crash if device does not provide full stress and spo2 data

This commit is contained in:
José Rebelo 2023-12-23 14:08:39 +00:00
parent a62ff4eabb
commit 5ffed2aa62
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ public class XiaomiSpo2SampleProvider extends AbstractSampleToTimeSampleProvider
@Override
protected Spo2Sample convertSample(final XiaomiActivitySample sample) {
if (sample.getSpo2() == 0) {
if (sample.getSpo2() == null || sample.getSpo2() == 0) {
return null;
}

View File

@ -29,7 +29,7 @@ public class XiaomiStressSampleProvider extends AbstractSampleToTimeSampleProvid
@Override
protected StressSample convertSample(final XiaomiActivitySample sample) {
if (sample.getStress() == 0) {
if (sample.getStress() == null || sample.getStress() == 0) {
return null;
}