I'm hitting the following assert in B2G on debug builds:
Assertion failure: i < Length() (invalid array index), at ../../dist/include/nsTArray.h:535
This appears to be occuring with light sensors which only have a single value. The nsDeviceSensors::Notify function blindly pulls 3 values which causes the assert.
Created attachment 629033 [details] [diff] [review]
One way of resolving the problem.
I would do
const InfallibleTArray<float>& values = aSensorData.values();
size_t len = values.Length();
double x = len > 0 ? values : 0.0;
double y = len > 1 ? values : 0.0;
Created attachment 629041 [details] [diff] [review]
Proposed patch for bug 760347 v2
OK - I like the looks of your version better.