Acknowledged

SensorHistory.getOxygenSaturationHistory returns null on fēnix 7X PRO: 13.22

from era on my watchface : man of steel

~~~js

Error Name: Unexpected Type Error
Occurrences: 8
First Occurrence: 2023-06-28
Last Occurrence: 2023-06-28
Devices:
fēnix® 7X PRO: 13.22
App Versions: 2023.06.28-2
Languages: chs
Backtrace:
getDFInfo.getSpo2:750
getDFInfo.getValueForType:256
drawDataField.drawData:179
drawDataField.draw:141
ManOfSteelView.onUpdate:136

~~~

The user contact me and I made a debug: 

~~~js

//add a null check

            if (Iterator == null) {
                Log.debug("Iterator is null");
                return "--";
            }

~~~

it shows "--" and stop crash

  • yes , it always return null ,and  I already added null check. BUT in the api document, it will never be null , should I always add a null check everywhere? actually I have already added some null check where should not be , such as active history. 

    ps. the  watch do have spo2 value,because I asked the owner to check it in the widget.  but it still  returns null .

  • Does this always return null on this product, or is this just an occasional issue? It's not necessarily a bug if it does return null, and it's a good idea to include null checks for things like this in general. We have had some reports about getOxygenSaturationHistory in the past, but I don't see any open issues at the moment.

  • yes, I've searched the forum and have seen your post about this, but I can't find the null value of it , because most of the watchface don't have a null check(as it supposed to never be null)so I think it's necessary to do these

  • I'm not sure if getOxygenSaturationHistory have ever really worked right on any real devices.  There are a number of bug reports from over the years..  Nulls, always oldest sample first, etc.