From 1c85f89bbd0a2f0b82da2e29f41e965ac8f37b4b Mon Sep 17 00:00:00 2001 From: Jan Philipp Sachse Date: Tue, 18 Jun 2024 08:34:15 -0700 Subject: [PATCH] Check whether a button is actually an M3CButton before assuming so. PiperOrigin-RevId: 644396761 --- .../Dialogs/src/private/MDCAlertControllerView+Private.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Dialogs/src/private/MDCAlertControllerView+Private.m b/components/Dialogs/src/private/MDCAlertControllerView+Private.m index f71e090b6ab..74263db18aa 100644 --- a/components/Dialogs/src/private/MDCAlertControllerView+Private.m +++ b/components/Dialogs/src/private/MDCAlertControllerView+Private.m @@ -1059,7 +1059,7 @@ - (void)layoutHorizontalButtons:(NSArray *)buttons actionSize:(CGSiz } buttonOrigin.y = actionsInsets.top; for (UIButton *button in buttons) { - if (self.isM3CButtonEnabled) { + if (self.isM3CButtonEnabled && [button isKindOfClass:M3CButton.class]) { M3CButton *m3cButton = (M3CButton *)button; if (m3cButton.textCanWrap) { m3cButton.textCanWrap = false; @@ -1126,7 +1126,7 @@ - (void)layoutVerticalButtons:(NSArray *)buttons { buttonCenter.y = buttonOrigin.y; for (NSUInteger index = 0; index < buttons.count; ++index) { UIButton *button = buttons[index]; - if (self.isM3CButtonEnabled) { + if (self.isM3CButtonEnabled && [button isKindOfClass:M3CButton.class]) { M3CButton *m3cButton = (M3CButton *)button; m3cButton.textCanWrap = YES; self.titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;