Complete
over 1 year ago

Array out of bounds error in trivial heartBeatIntervalsCallback()

Trying to troubleshoot a crash in on Venu 3, I found that the simulator (SDK 6.4.2) also gives a crash for a trivial  heartBeatIntervalsCallback()

   function initialize() {
        View.initialize();
        Sensor.setEnabledSensors([Sensor.SENSOR_HEARTRATE]);
        Sensor.enableSensorEvents(null);
    }
 
  var heartBeatIntervals as Lang.Array<Lang.Number> = [] ;

    function heartBeatIntervalsCallback(sensorData as Toybox.Sensor.SensorData) as Void {
        if (sensorData has :heartRateData){
            if (sensorData.heartRateData != null) {
                heartBeatIntervals = sensorData.heartRateData.heartBeatIntervals;
            }
        }
    }

From the debug console:

Error: Array Out Of Bounds Error Details: Error in sensor data callback Stack:
Encountered app crash.
---------------------------------------------------------------
Sometimes this takes a few minutes to happen.  This is in an activity app.
Parents
  • Please post this to the discussion thread since this is requesting help debugging an app. This are is for reporting Connect IQ SDK & API bugs. If you are able to determine that the problem you're seeing is not due to a bug in your code and can demonstrate that it is a Connect IQ bug, you can create a new report.

Comment
  • Please post this to the discussion thread since this is requesting help debugging an app. This are is for reporting Connect IQ SDK & API bugs. If you are able to determine that the problem you're seeing is not due to a bug in your code and can demonstrate that it is a Connect IQ bug, you can create a new report.

Children
No Data