Acknowledged
CIQQA-3244

Device Crashes When Deleting Item from Active CustomMenu

Deleting a menu item from a CustomMenu that is currently displayed causes the app to crash on the Epix 2 Pro 47mm.

The call to CustomMenu.deleteItem successfully removes the item, but on the next UI update, the app crashes with the following error:

Error: Array Out Of Bounds Error
Time: 2025-05-19T19:36:09Z
Part-Number: 006-B4313-00
Firmware-Version: 20.22
Language-Code: eng
ConnectIQ-Version: 5.1.1
Store-Id: 8a6b62f1-5450-4912-8799-2eeaf9779d97
Store-Version: 44
Filename: F56A2548
Appname: openHAB
Stack:

The issue also affects addItem, though less severely. When a new item is added, it does not appear during the next UI update.

In the simulator, both addItem and deleteItem work as expected—menu changes are reflected correctly on the next UI refresh.

Project: ohg on GitHub
Relevant CustomMenu implementation: BasePageMenu.mc

  • I made a simple custom menu with multiple items and called deleteItem() on the 0th item and I wasn't seeing the out of bounds error until all the items had been deleted and it attempted to delete an item that didn't exist. 

    your call to deleteItem() call in BaseMenu.mc looks correct, but I can't tell exactly how you are handling views. Is it possible your itemCount used for indexing is getting out of sync with the number of items in your custom menu?

  • Calling switchToView with the current view forces a proper refresh of the CustomMenu, making it an effective workaround:

    WatchUi.switchToView(
        WatchUi.getCurrentView()[0] as View,
        WatchUi.getCurrentView()[1] as InputDelegate,
        WatchUi.SLIDE_IMMEDIATE
    );
    WatchUi.requestUpdate();