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
For each of the non-enum RPC classes, there will sometimes be one or more properties of a type that is a subclass of SDLRPCStruct (e.g. SDLImage). If any of the getters for these properties are called when the property has not been set, then, instead of returning nil, the getter will return an object of the appropriate type initialized with a dictionary of nil.
If image was not previously set, then obj will equal nil. Because of this, the second return statement will run, and it will return [[SDLImage alloc] initWithDictionary:nil].
As a result of the nil dictionary, if the user tries to edit this object directly from the getter reference in any way, nothing will happen. The user will have no way of knowing this, as they cannot check whether the internal dictionary is nil. This would result in some very hard to diagnose errors.
For each of the non-enum RPC classes, there will sometimes be one or more properties of a type that is a subclass of
SDLRPCStruct
(e.g.SDLImage
). If any of the getters for these properties are called when the property has not been set, then, instead of returningnil
, the getter will return an object of the appropriate type initialized with a dictionary ofnil
.Example:
If
image
was not previously set, thenobj
will equalnil
. Because of this, the second return statement will run, and it will return[[SDLImage alloc] initWithDictionary:nil]
.As a result of the
nil
dictionary, if the user tries to edit this object directly from the getter reference in any way, nothing will happen. The user will have no way of knowing this, as they cannot check whether the internal dictionary isnil
. This would result in some very hard to diagnose errors.Example:
To fix this, a
obj == nil
check could be added to each of these getters as such:The text was updated successfully, but these errors were encountered: