Skip to content

Commit c78c1ef

Browse files
pekingmeikim24
authored andcommitted
[ProgressIndicator] Fixed NPE while setting progress in the indeterminate mode after inflation.
PiperOrigin-RevId: 351656379 (cherry picked from commit 7a9e3f6)
1 parent e9fcdf0 commit c78c1ef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/java/com/google/android/material/progressindicator/BaseProgressIndicator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,10 @@ public void setProgressCompat(int progress, boolean animated) {
721721
storedProgressAnimated = animated;
722722
isIndeterminateModeChangeRequested = true;
723723

724-
if (animatorDurationScaleProvider.getSystemAnimatorDurationScale(
725-
getContext().getContentResolver())
726-
== 0) {
724+
if (!getIndeterminateDrawable().isVisible()
725+
|| animatorDurationScaleProvider.getSystemAnimatorDurationScale(
726+
getContext().getContentResolver())
727+
== 0) {
727728
switchIndeterminateModeCallback.onAnimationEnd(getIndeterminateDrawable());
728729
} else {
729730
getIndeterminateDrawable().getAnimatorDelegate().requestCancelAnimatorAfterCurrentCycle();

0 commit comments

Comments
 (0)