Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of nullable values in iOS renderer
This pull request improves the usage of nullable values that can be returned by various bits of the iOS renderer. The initial place this appeared was [this rive-ios issue](#330), where in the provided stack trace, we can see the following: ``` ... "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"}, "termination" : {"flags":0,"code":6,"namespace":"SIGNAL","indicator":"Abort trap: 6","byProc":"Application","byPid":1045}, "asi" : {"libsystem_c.dylib":["abort() called"]}, "exceptionReason" : {"arguments":["-[__NSArrayM insertObject:atIndex:]"],"format_string":"*** %s: object cannot be nil","name":"NSInvalidArgumentException","type":"objc-exception","composed_message":"*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil","class":"NSException"}, "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, "lastExceptionBacktrace" : [ {"imageOffset":978358,"symbol":"__exceptionPreprocess","symbolLocation":226,"imageIndex":9}, {"imageOffset":81565,"symbol":"objc_exception_throw","symbolLocation":48,"imageIndex":7}, {"imageOffset":123841,"symbol":"-[__NSArrayM insertObject:atIndex:]","symbolLocation":1762,"imageIndex":9}, {"imageOffset":35776,"symbol":"-[RiveStateMachineInstance stateChanges]","symbolLocation":178,"imageIndex":1}, ... ``` Peeking into `-[RiveStateMachineInstance stateChanges]` showed that we were not checking if the nullable value was valid before attempting to insert into an array, thus under certain conditions inserting nil (those conditions still tbd; I've asked the dev for a hopefully reproducible file). I went ahead and peeked at various other portions of the renderer for nullable usage and added some other checks for array insertion that were similar. Diffs= cd8fef48f Improve handling of nullable values in iOS renderer (#7529) Co-authored-by: David Skuza <[email protected]>
- Loading branch information