Skip to content

Commit 98df9b1

Browse files
fkgozalimeta-codesync[bot]
authored andcommitted
Fix RCTTextLayoutManager nullable conversion (#56547)
Summary: Pull Request resolved: #56547 The original fix in `RCTTextLayoutManager.mm` used the pattern `[obj UTF8String] != nullptr ? [obj UTF8String] : ""`, but Clang's null analysis still types the first operand as `_Nullable`, so `-Wnullable-to-nonnull-conversion` is still triggered as a hard error under Xcode 26.4. Switch to the local-variable pattern that was already used correctly for `RNTMyNativeViewCommon.mm`: ``` const char *renderedUTF8 = [renderedString UTF8String]; ... std::string(renderedUTF8 != nullptr ? renderedUTF8 : "") ... ``` Changelog: [Internal] Reviewed By: javache Differential Revision: D101920741 fbshipit-source-id: 918e1638e65f62bb8d87628636297f8f7eef221e
1 parent 54ced39 commit 98df9b1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager

packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ - (LinesMeasurements)getLinesForAttributedString:(facebook::react::AttributedStr
208208
.width = usedRect.size.width, .height = usedRect.size.height}};
209209

210210
CGFloat baseline = [layoutManager locationForGlyphAtIndex:range.location].y;
211+
const char *renderedUTF8 = [renderedString UTF8String];
211212
auto line = LineMeasurement{
212-
std::string(
213-
[renderedString UTF8String] != nullptr ? [renderedString UTF8String] : ""),
213+
std::string(renderedUTF8 != nullptr ? renderedUTF8 : ""),
214214
rect,
215215
overallRect.size.height - baseline,
216216
font.capHeight,

0 commit comments

Comments
 (0)