You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been seeing a crash after using the generated inits and then accessing a nil property. It occurs within DataDict.swift
The crash is on line 78 but I believe the issue is from line 91, where an AnyHashable? is unwrapped unsuccessfully and is then passed along as AnyHashable with a value of nil on line 95. I don't know if it's an issue in the inits not managing nil values properly or a swift dynamic casting issue with the functions here.
lldb on line 95:
(lldb) po data
▿ AnyHashable(nil)
- value : nil
Here is the full generated model we're trying to initialise. A bunch of properties have been removed to simplify it:
publicstructAppPageHeroSectionData:ShopAPI.SelectionSet,Fragment{publicstaticvarfragmentDefinition:StaticString{""" fragment AppPageHeroSectionData on AppPageHeroSection { __typename id personalizedMessaging { __typename id title } }"""}publiclet__data:DataDictpublicinit(_dataDict:DataDict){ __data = _dataDict }publicstaticvar__parentType:ApolloAPI.ParentType{ShopAPI.Objects.AppPageHeroSection }publicstaticvar__selections:[ApolloAPI.Selection]{[.field("__typename",String.self),.field("id",ShopAPI.ID.self),.field("personalizedMessaging",PersonalizedMessaging?.self),]}publicvarid:ShopAPI.ID{__data["id"]}publicvarpersonalizedMessaging:PersonalizedMessaging?{__data["personalizedMessaging"]}publicinit(
id:ShopAPI.ID,
personalizedMessaging:PersonalizedMessaging?=nil){self.init(_dataDict:DataDict(data:["__typename":ShopAPI.Objects.AppPageHeroSection.typename,"id": id,"personalizedMessaging": personalizedMessaging._fieldData,"__fulfilled":Set([ObjectIdentifier(Self.self)])]))}
/// PersonalizedMessaging
///
/// Parent Type: `PersonalizedMessagingTextBlock`
publicstructPersonalizedMessaging:ShopAPI.SelectionSet{publiclet__data:DataDictpublicinit(_dataDict:DataDict){ __data = _dataDict }publicstaticvar__parentType:ApolloAPI.ParentType{ShopAPI.Objects.PersonalizedMessagingTextBlock }publicstaticvar__selections:[ApolloAPI.Selection]{[.field("__typename",String.self),.field("id",ShopAPI.ID.self),.field("title",String.self),]}publicvarid:ShopAPI.ID{__data["id"]}publicvartitle:String{__data["title"]}publicinit(
id:ShopAPI.ID,
title:String){self.init(_dataDict:DataDict(data:["__typename":ShopAPI.Objects.PersonalizedMessagingTextBlock.typename,"id": id,"title": title,"__fulfilled":Set([ObjectIdentifier(Self.self)])]))}}}
Summary
We've been seeing a crash after using the generated inits and then accessing a nil property. It occurs within DataDict.swift
The crash is on line 78 but I believe the issue is from line 91, where an
AnyHashable?
is unwrapped unsuccessfully and is then passed along as AnyHashable with a value of nil on line 95. I don't know if it's an issue in the inits not managing nil values properly or a swift dynamic casting issue with the functions here.lldb on line 95:
Here is the full generated model we're trying to initialise. A bunch of properties have been removed to simplify it:
Version
Apollo: 1.1.0-beta
Xcode: 14.2
Swift: 5.7.2
iOS: 16.2
Steps to reproduce the behavior
Create a SelectionSet that has an optional SelectionSet property, initialise that to nil and access it.
Logs
No response
Anything else?
This may be related to the following 2 issues:
The text was updated successfully, but these errors were encountered: