Skip to content

Conversation

@bjorkert
Copy link
Contributor

What & Why

dexShare?.fetchData() could return an empty array even when the network call succeeds.
Our previous guard only checked for nil, so subscripting data[0] would crash with “index out of range”.

Changes

  • Extend the guard clause to guard let data = result, !data.isEmpty
  • Update the log message to “Received empty data array from Dexcom” for clarity.

How to test

  1. Point the Dexcom share stub/service at a response that returns [].
  2. Launch the app and trigger a download.
  3. Verify:
    • No crash occurs.
    • Log output shows the new message.
    • The fallback to webLoadNSBGData() is executed.

Notes

No functional changes beyond the safety check.

@bjorkert bjorkert requested a review from marionbarker June 17, 2025 19:32
@bjorkert bjorkert changed the base branch from main to dev June 17, 2025 19:32
Copy link
Collaborator

@dnzxy dnzxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely sane and surgical check update. LGTM.

@marionbarker marionbarker merged commit bceae4b into dev Jun 17, 2025
@marionbarker marionbarker deleted the dexcom-empty-data-guard branch June 28, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants