fix(android): check null activity
If activity is null at initialization, the app crashes. This change checks for null activity and throw react native error, which prevents app crash.
This commit is contained in:
parent
133ede773e
commit
c263cc89ff
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user