warmsound / crystal-face

Garmin Connect IQ watch face

Home Page:https://apps.garmin.com/en-GB/apps/9fd04d09-8c80-4c81-9257-17cfa0f0081b

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ERA] Array Out Of Bounds Error at CrystalView.updateHoursMinutesColours:256, 2408 Occurrences

warmsound opened this issue · comments

Error Name: Array Out Of Bounds Error
Occurrences: 2408
First Occurrence: 2019-06-20
Last Occurrence: 2021-01-01
Devices:
    fēnix® 5S Plus: 14.00
    fēnix® 5 Plus: 14.00, 13.00
    vívoactive® 3: 7.60, 7.40, 7.50, 7.30
    fēnix® 5X Plus: 13.10, 13.00
    Forerunner® 645 Music: 6.70
    fēnix® 5S Plus: 13.10
    fēnix® 5X / tactix® Charlie: 21.00, 19.10
    Forerunner® 645 Music: 6.70
    vívoactive® 3 Music: 6.00, 6.10
    fēnix® 5X Plus: 14.00, 13.00
    Forerunner® 935: 21.00, 19.10
    fēnix® 5X / tactix® Charlie: 14.20, 20.10
    vívoactive® 3: 7.40, 7.20, 7.30
    fēnix® 5S: 20.10
    fēnix® 5 / quatix® 5: 20.10
    vívoactive® 3 Music: 6.00, 4.90, 5.60, 5.40
    Descent™ Mk1: 10.40
    Forerunner® 935: 21.00
    fēnix® 5 / quatix® 5: 12.50, 20.00, 21.00
    fēnix® 5 Plus: 13.10
    fēnix® 5S: 15.10, 21.00
App Versions: 2.4.3
Languages: ces, chs, cht, dan, deu, dut, eng, fin, fre, gre, heb, hrv, hun, ita, jpn, kor, nob, pol, por, rus, slo, slv, spa, swe, tha
Backtrace:
    CrystalView.updateHoursMinutesColours:256
    CrystalView.onSettingsChanged:171
    CrystalApp.onSettingsChanged:52
    CrystalApp.getInitialView:38

getProperty() may be returning null, or unexpected type, similar to #123.

Similar ERA error:

Error Name: Unhandled Exception
Occurrences: 108
First Occurrence: 2020-12-11
Last Occurrence: 2020-12-31
Devices:
    fēnix® 6 / 6 Solar / 6 Dual Power: 10.10
    Forerunner® 245: 5.00, 4.10, 4.00, 3.10, 4.40
    vívoactive® 3: 7.40, 7.50
App Versions: 2.4.3
Languages: chs, deu, eng, jpn, kor, pol, tha, vie
Backtrace:
    CrystalView.updateThemeColours:194
    CrystalView.onSettingsChanged:168
    CrystalApp.onSettingsChanged:52
    CrystalApp.getInitialView:38

Fix by implementing safe int getter, getIntProperty(key, defaultValue), inspired by readKeyInt().

Should also fix several others, including:

Error Name: Unexpected Type Error
Occurrences: 24
First Occurrence: 2020-12-11
Last Occurrence: 2020-12-30
Devices:
    Venu™: 5.10
App Versions: 2.4.3
Languages: eng, ita, pol
Backtrace:
    DataFields.update:121
    DataFields.update:121
    DataFields.update:113
    DataFields.draw:99
    Rez.AlwaysOn:60
    Rez.AlwaysOn:60
    CrystalView.onUpdate:310
Error Name: Array Out Of Bounds Error
Occurrences: 12
First Occurrence: 2020-12-16
Last Occurrence: 2021-01-01
Devices:
    vívoactive® 3: 7.40
App Versions: 2.4.3
Languages: eng, spa
Backtrace:
    DataFields.onSettingsChanged:88
    DataFields.initialize:65
    Rez.WatchFace:33
    CrystalView.onLayout:126

Reopening, as original issue still occurring on 2.4.4, 1081 occurrences as of 12 Jan.

This suggests that the data type returned by getProperty() may not be the problem, but rather the value. The only possible settings values are 0, 1 and 2, so a rogue value must be creeping in somehow. We probably need a try...catch here that uses a default 0 value if an exception occurs.

There's a much smaller number of exceptions (6 as of writing) triggered by the following line that gets the MinutesColourOverride value.