Fix NGLineBreaker hang

This is a regression in r796465 crrev.com/c/2344431 but the
issue reproduces only in M86.

This CL minimizes the change to make the merge easier. Clean
up CL will follow.

Bug: 1139513
Change-Id: Ie55ebd286534f27df245587f11f03b108b50305c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2482623
Reviewed-by: Krishna Govind <[email protected]>
Commit-Queue: Krishna Govind <[email protected]>
Cr-Commit-Position: refs/branch-heads/4240@{#1266}
Cr-Branched-From: f297677702651916bbf65e59c0d4bbd4ce57d1ee-refs/heads/master@{#800218}
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
index 568bec8..356404f 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
@@ -1008,8 +1008,10 @@
   if (item_index_ >= items.size())
     return;
   const NGInlineItem& item = items[item_index_];
-  if (const ShapeResult* shape_result = item.TextShapeResult())
-    HandleTrailingSpaces(item, *shape_result, line_info);
+  const ShapeResult* shape_result = item.TextShapeResult();
+  // TODO(kojii): We need to call |HandleTrailingSpaces| even when
+  // |shape_result| is |nullptr|. Clean this up.
+  HandleTrailingSpaces(item, *shape_result, line_info);
 }
 
 inline void NGLineBreaker::HandleTrailingSpaces(const NGInlineItem& item,