This repository was archived by the owner on Dec 11, 2025. It is now read-only.
Commit bea213a
Fix SnackBar crash when snackbarView is nil
These changes ensure that the CABasicAnimations involved in sliding snack bars on and off the screen are non-nil before they're added to an array.
I tested it by commenting out the following snackbarView-related code here to ensure that the snackbarView would be nil:
https://github.com/material-components/material-components-
ios/blob/develop/components/Snackbar/src/MDCSnackbarManager.m#L209-L230)
Without the changes in this CL it crashed, which was expected. With the changes, it did not crash. However, the snack bar did not show. Future changes should provide better error handling to help elucidate the circumstances in which the snackbarView. Improved error handling might entail adding NSError parameters to the completion blocks, for example. In the immediate term, however, my feeling is that we should just fix the crash.
PiperOrigin-RevId: 3024905691 parent 9a006b8 commit bea213a
1 file changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
584 | | - | |
585 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
586 | 589 | | |
587 | | - | |
588 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
589 | 595 | | |
590 | 596 | | |
591 | 597 | | |
| |||
0 commit comments