@@ -75,24 +75,26 @@ - (id)copyDeepTransformOf:(id)nodeIn {
75
75
76
76
NSArray * childrenIn ;
77
77
78
- if ((childrenIn = [nodeIn performSelector: _childrenInExtractor])) {
79
- for (id childIn in childrenIn) {
80
- // Get next child out with recursion
81
- id nextChildOut = [self copyDeepTransformOf: childIn] ;
82
- // nextChildOut may be nil, in particular for Safari, because of iCloud, deleted
83
- // starks are not deleted before the actual export. To delete them, we
84
- // temporarily set the stark's 'isDeletedThisIxport' flag bit, in
85
- // -[ExtoreSafari extoreRootsForExport], which causes
86
- // extoreItemForSafari:, or reformatter, and thus this method, to return nil.
87
- // I noted once that there are other cause(s) in BookMacster which can make
88
- // nextChildOut be nil at this point, but did not document them.
89
- if (nextChildOut) {
90
- [nextChildOut performSelector: _newParentMover withObject: nodeOut] ;
91
- // Since the above will add nextChildOut to nodeOut's Children array, I can now release it.
92
- [nextChildOut release ] ;
93
- }
94
- }
95
- }
78
+ if ([nodeIn respondsToSelector: _childrenInExtractor]) { // Defensive programming
79
+ if ((childrenIn = [nodeIn performSelector: _childrenInExtractor])) {
80
+ for (id childIn in childrenIn) {
81
+ // Get next child out with recursion
82
+ id nextChildOut = [self copyDeepTransformOf: childIn] ;
83
+ // nextChildOut may be nil, in particular for Safari, because of iCloud, deleted
84
+ // starks are not deleted before the actual export. To delete them, we
85
+ // temporarily set the stark's 'isDeletedThisIxport' flag bit, in
86
+ // -[ExtoreSafari extoreRootsForExport], which causes
87
+ // extoreItemForSafari:, or reformatter, and thus this method, to return nil.
88
+ // I noted once that there are other cause(s) in BookMacster which can make
89
+ // nextChildOut be nil at this point, but did not document them.
90
+ if (nextChildOut) {
91
+ [nextChildOut performSelector: _newParentMover withObject: nodeOut] ;
92
+ // Since the above will add nextChildOut to nodeOut's Children array, I can now release it.
93
+ [nextChildOut release ] ;
94
+ }
95
+ }
96
+ }
97
+ }
96
98
97
99
return [nodeOut retain ] ;
98
100
// Since this method must return a "copy", but nodeOut was autoreleased, I retain it before returning
0 commit comments