-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding null check for context before calling
Utils.getAnimationScale
(
#2546) When calling reduce motion check we need to pass context, we read context in LottieDrawable using `getContext` method. getContext method can return a nullable context, since the code is in java we don't get any compile time error when passing the null context around. This resulted in issue where we end up calling `getContentResolver` on a null object in case where context is null. #2536 This PR fixes it by adding a null check before calling `Utils.getAnimationScale(context)` Co-authored-by: Pranay Airan <[email protected]>
- Loading branch information
1 parent
0cf178c
commit 453b43c
Showing
4 changed files
with
8 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
lottie/src/main/java/com/airbnb/lottie/configurations/reducemotion/ReducedMotionOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package com.airbnb.lottie.configurations.reducemotion; | ||
|
||
import android.content.Context; | ||
import androidx.annotation.Nullable; | ||
|
||
public interface ReducedMotionOption { | ||
|
||
/** | ||
* Returns the current reduced motion mode. | ||
*/ | ||
ReducedMotionMode getCurrentReducedMotionMode(Context context); | ||
ReducedMotionMode getCurrentReducedMotionMode(@Nullable Context context); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters