Reading SensorHistory.SensorSample data causes exception even though SensorHistory.SensorSample is not null

I have the following code that reads SpO2 history data:

            var sensorIter = getIteratorSpO2(i==0);
            // get the next entry in the iterator
            if (sensorIter != null) {
                // returns float or null
                res[i]=sensorIter.next();
                if (res[i]!=null) {                                 // this check is passed, res[i] is not null
                    var resDat=res[i].data;
                    valid[i]=resDat>=0 && resDat<=100;   // exception occurs on his line
                }
            }
An unknown exception occurs on the line marked above.  It it possible that res[i].data is null even though res[i] is not null?
What other exception could have occurred?
I don't know the exact exception because this is happening on a watch that I don:t have and not in the simulator.
This is happening on a Fenix 6S PRO.