Skip to content

Commit

Permalink
get rid of weird nil check on CGFloat
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

this doesn't really make any sense, first of all CGFloat is a primitive data type so comparing it against nil only will return true if it's 0. but that won't catch cases where CGFloat is uninitialized bc it will be holding junk in memory.

the error checking of the value is already handled in the accessibility manager, so just remove it here.

Reviewed By: p-sun

Differential Revision: D34909365

fbshipit-source-id: 483f9c100433f8533edd784622523c5469c616c2
  • Loading branch information
philIip authored and facebook-github-bot committed Mar 17, 2022
1 parent 9b4bb54 commit 126873f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions React/CoreModules/RCTDeviceInfo.mm
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ static BOOL RCTIsIPhoneX()
RCTAssertMainQueue();
RCTDimensions dimensions;
if (moduleRegistry) {
dimensions = RCTGetDimensions(
((RCTAccessibilityManager *)[moduleRegistry moduleForName:"AccessibilityManager"]).multiplier ?: 1.0);
RCTAccessibilityManager *accessibilityManager =
(RCTAccessibilityManager *)[moduleRegistry moduleForName:"AccessibilityManager"];
dimensions = RCTGetDimensions(accessibilityManager ? accessibilityManager.multiplier : 1.0);
} else {
RCTAssert(false, @"ModuleRegistry must be set to properly init dimensions.");
}
Expand Down

0 comments on commit 126873f

Please sign in to comment.