Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Prevent crash by handling missing eventType in updateTreatments #259

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

bjorkert
Copy link
Contributor

@bjorkert bjorkert commented Mar 4, 2024

Summary

This pull request addresses a critical issue where the application could crash if an eventType was missing in any of the entries processed by the updateTreatments function. By implementing a guard statement to check for the presence of eventType, we ensure the function safely skips any entries lacking this essential piece of data.

Changes

  • Added a guard statement in updateTreatments to check for the presence of eventType in each entry.
  • Entries without an eventType are now safely ignored, preventing potential crashes.

Testing

  • Tested with a dataset containing a mix of entries with and without eventType to ensure that the function behaves as expected.
  • Confirmed that entries missing eventType are skipped without causing crashes, while valid entries continue to be processed correctly.

Please review the changes and let me know if there are any concerns or further improvements needed. Thank you!

@bjorkert bjorkert requested a review from marionbarker March 4, 2024 08:38
@bjorkert
Copy link
Contributor Author

bjorkert commented Mar 4, 2024

  • Switched from a traditional for i loop to a more Swift-idiomatic for-in loop.
  • Corrected a typo in the condition that checks basalData.count.

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.

2 participants