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
  • This is a simulator bug. If I exit the app in the simulator before trying a new run instance ( Run-> Start Debugging on same device) then everything works. If I exit the simulator (quit) before another debug run then everything works. If I "Start Debugging" while one is currently running then crashes every time with same message and no stack trace. After a series of crashes in the app I'm running then on close of the simulator I get the apple crash window.

Comment
  • This is a simulator bug. If I exit the app in the simulator before trying a new run instance ( Run-> Start Debugging on same device) then everything works. If I exit the simulator (quit) before another debug run then everything works. If I "Start Debugging" while one is currently running then crashes every time with same message and no stack trace. After a series of crashes in the app I'm running then on close of the simulator I get the apple crash window.

Children
No Data