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

safer handling of nil superProperties #183

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

jaredmixpanel
Copy link
Collaborator

@jaredmixpanel jaredmixpanel commented Apr 17, 2023

nil-coalesce properties to empty object to hopefully provide safer handling and fix #179

@@ -5,7 +5,7 @@ class AutomaticProperties {
static var peopleProperties: Dictionary<String, MixpanelType> = [:];

static func setAutomaticProperties(_ properties: [String: Any]) {
for (key,value) in properties {
for (key,value) in properties ?? [:] {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is in line with how we process the same properties object elsewhere: https://github.com/mixpanel/mixpanel-react-native/blob/master/ios/MixpanelTypeHandler.swift#L77

Copy link

@illiriks illiriks left a comment

Choose a reason for hiding this comment

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

LGTM

@jaredmixpanel jaredmixpanel added the bug Something isn't working label Apr 17, 2023
@jaredmixpanel jaredmixpanel merged commit 6d37bcb into master Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MixPanel causing app to crash on latest react native
2 participants