Skip to content

Commit

Permalink
[TypefaceUtils] Add defensive null check for typeface passed in to util
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 465333642
  • Loading branch information
dsn5ft authored and drchen committed Aug 4, 2022
1 parent 276a0a3 commit 2b1af84
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public static Typeface maybeCopyWithFontWeightAdjustment(
@NonNull Configuration configuration, @NonNull Typeface typeface) {
if (VERSION.SDK_INT >= VERSION_CODES.S
&& configuration.fontWeightAdjustment != Configuration.FONT_WEIGHT_ADJUSTMENT_UNDEFINED
&& configuration.fontWeightAdjustment != 0) {
&& configuration.fontWeightAdjustment != 0
&& typeface != null) {
int adjustedWeight =
MathUtils.clamp(
typeface.getWeight() + configuration.fontWeightAdjustment,
Expand Down

0 comments on commit 2b1af84

Please sign in to comment.