Skip to content

Commit b1ea205

Browse files
committed
• Added some defensive programming.
• LaunchDog default build configuration is now Release. I'm not sure if I did this or Xcode did. Does it even matter?
1 parent 4caff89 commit b1ea205

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

SSYTreeTransformer.m

+20-18
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,26 @@ - (id)copyDeepTransformOf:(id)nodeIn {
7575

7676
NSArray* childrenIn ;
7777

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+
}
9698

9799
return [nodeOut retain] ;
98100
// Since this method must return a "copy", but nodeOut was autoreleased, I retain it before returning

0 commit comments

Comments
 (0)