From 821232a9c69a7a4bdb3f0603bdee8c7e9f0d443e Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Fri, 10 May 2019 09:50:21 -0700 Subject: [PATCH] Fix the crash in the watch tab Summary: BUG: {F158264042} Context: The code entered an infinite loop till it crashed. In the implementation of `- (SKSearchResultNode *)searchForQuery:(NSString *)query fromNode:(id)node withElementsAlreadyAdded:(NSMutableSet *)alreadyAdded`, we recurse through the child. In the case when the view was `CKRootComponent` it created a `SKComponentLayoutWrapper` in the call to `[descriptor childForNode: node atIndex: i];`. This wrapper's descriptor used to return the very same view from which it was created when it's children were asked. So this led to an infinite loop. Reviewed By: kfirapps Differential Revision: D15266478 fbshipit-source-id: 8035209746b7cb4b8773e2fcbdd4c0a148191304 --- .../SKComponentLayoutDescriptor.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentLayoutDescriptor.mm b/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentLayoutDescriptor.mm index b39ed7be9..73383975e 100644 --- a/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentLayoutDescriptor.mm +++ b/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/SKComponentLayoutDescriptor.mm @@ -86,7 +86,7 @@ - (id)childForNode:(SKComponentLayoutWrapper *)node atIndex:(NSUInteger)index { if (node.children.size() == 0) { - return node.component.viewContext.view; + return nil; } return node.children[index]; }