Accessing null array crashes all Connect IQ watch faces on Fenix

I am almost sure this bug was already reported, but I still want to mention it, it is quite annoying for me. Maybe I can help you with resolving it, or with providing a sample code.

I have a watch face app (SDK 2.3.x, Fenix 5S, no extra background tasks, just a simple project). When I call in the onLayout(dc) this code:

if (days[bucketIndex] != currentDay) {
days[bucketIndex] = currentDay;
}


when currentDay is a number, bucketIndex == 0 and days == null, this watchface crashes (because I am accessing a zero index of the array that is null). That's fine, even this error is correctly written into the CIQ_LOG.TXT:

ERROR: Unhandled Exception
DETAILS: NONE
STORE_ID: 00000000000000000000000000000000
CALLSTACK:
UnexpectedTypeException: Expected String/Object/Array/Dictionary, given null


But there is a problem. It seems that if this happens, the whole runtime crashes. Even when I fix this error and upload a new .prg application into the watch, it still displays the IQ! icon and the watch face cannot be displayed. Even more, all Connect IQ watchfaces downloaded from the store also display the IQ! icon and cannot be selected.

So, if I want to make it work, I need to completely restart Fenix, then I can select the watch face. I think this should not happen, it seems there is no memory or other resources problem that can cause it, just the null reference exception. Each application should live in its own sandbox.

Video: https://youtu.be/S0yt7n7bRJg

Thank you!
  • Former Member
    Former Member over 7 years ago
    The applications are sandboxed, but what I suspect you are seeing here, is that something about this failure is preventing the sandbox for the application that triggered it from being cleaned up. This means that when another application attempts to run, there is no memory available to allocate its sandbox, and we fail to start up the app (resulting in the IQ!).