Merge pull request #2955 from wjaykim/patch-1

fix(android): check null activity
This commit is contained in:
Olivier Bouillet 2022-12-16 18:21:00 +01:00 committed by GitHub
commit a2cdf0f656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -573,6 +573,12 @@ class ReactExoplayerView extends FrameLayout implements
return; return;
} }
if (activity == null) {
Log.e("ExoPlayer Exception", "Failed to initialize Player!");
eventEmitter.error("Failed to initialize Player!", new Exception("Current Activity is null!"), "1001");
return;
}
// Initialize handler to run on the main thread // Initialize handler to run on the main thread
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
public void run() { public void run() {