Fix crash when connecting to watches in recovery firmware#83
Open
g150446 wants to merge 2 commits intocoredevices:masterfrom
Open
Fix crash when connecting to watches in recovery firmware#83g150446 wants to merge 2 commits intocoredevices:masterfrom
g150446 wants to merge 2 commits intocoredevices:masterfrom
Conversation
Recovery firmware returns an empty byte array for the BLE connectivity characteristic, causing ArrayIndexOutOfBoundsException when trying to parse connection status. Added bounds checking to handle empty arrays safely, allowing users to connect and update watches in recovery mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When firmware sideload failed with a safety check error (e.g., board mismatch), the UI would stay on "Idle" instead of showing the error message. Now properly displays error messages from the Idle state's lastFailure field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Member
|
(related: #81) Were you able to reproduce this regularly, to show that recovery FW always returns an empty characteristic value for this? We had been this happen a couple of times but it seemed random (i.e. like some kind of FW corruption bug, perhaps) - I would have assumed that we would have had a lot more stuck users if it really happened every time a Time watch was in PRF. Regardless, the fix it probably the same - but e.g. if it was just a transient thing which was fixed upon reconnection then i'd be tempted to leave it as-is (rather than assume the device is not paired and start repairing). But I have never reproduced it so your input is welcome... |
Member
|
Ping @g150446 re: question above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When connecting to a Pebble watch running recovery firmware (PRF), the app crashes with an
ArrayIndexOutOfBoundsExceptioninConnectivityWatcher.kt:91.Root Cause:
ConnectivityStatusconstructor attempts to accesscharacteristicValue[0]andcharacteristicValue[3]without checking if the array is emptyUser Impact:
Error from logs:
Solution
Added bounds checking in the
ConnectivityStatusconstructor to handle empty byte arrays from recovery firmware:characteristicValue.isEmpty(), initialize all fields with safe default values (all false, NO_ERROR)characteristicValue[3]if array size > 3Files Changed:
libpebble3/src/commonMain/kotlin/io/rebble/libpebblecommon/connection/bt/ble/pebble/ConnectivityWatcher.ktTesting