Skip to content

Commit 1c85f89

Browse files
jpsachsematerial-automation
authored andcommitted
Check whether a button is actually an M3CButton before assuming so.
PiperOrigin-RevId: 644396761
1 parent 04a7740 commit 1c85f89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/Dialogs/src/private/MDCAlertControllerView+Private.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ - (void)layoutHorizontalButtons:(NSArray<UIButton *> *)buttons actionSize:(CGSiz
10591059
}
10601060
buttonOrigin.y = actionsInsets.top;
10611061
for (UIButton *button in buttons) {
1062-
if (self.isM3CButtonEnabled) {
1062+
if (self.isM3CButtonEnabled && [button isKindOfClass:M3CButton.class]) {
10631063
M3CButton *m3cButton = (M3CButton *)button;
10641064
if (m3cButton.textCanWrap) {
10651065
m3cButton.textCanWrap = false;
@@ -1126,7 +1126,7 @@ - (void)layoutVerticalButtons:(NSArray<UIButton *> *)buttons {
11261126
buttonCenter.y = buttonOrigin.y;
11271127
for (NSUInteger index = 0; index < buttons.count; ++index) {
11281128
UIButton *button = buttons[index];
1129-
if (self.isM3CButtonEnabled) {
1129+
if (self.isM3CButtonEnabled && [button isKindOfClass:M3CButton.class]) {
11301130
M3CButton *m3cButton = (M3CButton *)button;
11311131
m3cButton.textCanWrap = YES;
11321132
self.titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;

0 commit comments

Comments
 (0)