File tree 1 file changed +5
-4
lines changed
ReactAndroid/src/main/java/com/facebook/react/devsupport
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 9
9
10
10
package com .facebook .react .devsupport ;
11
11
12
+ import android .app .Activity ;
12
13
import android .app .ActivityManager ;
13
14
import android .app .AlertDialog ;
14
15
import android .content .BroadcastReceiver ;
@@ -371,8 +372,8 @@ private void showNewError(
371
372
@ Override
372
373
public void run () {
373
374
if (mRedBoxDialog == null ) {
374
- Context context = mReactInstanceManagerHelper .getCurrentActivity ();
375
- if (context == null ) {
375
+ Activity context = mReactInstanceManagerHelper .getCurrentActivity ();
376
+ if (context == null || context . isFinishing () ) {
376
377
FLog .e (ReactConstants .TAG , "Unable to launch redbox because react activity " +
377
378
"is not available, here is the error that redbox would've displayed: " + message );
378
379
return ;
@@ -518,8 +519,8 @@ public void onOptionSelected() {
518
519
519
520
final DevOptionHandler [] optionHandlers = options .values ().toArray (new DevOptionHandler [0 ]);
520
521
521
- Context context = mReactInstanceManagerHelper .getCurrentActivity ();
522
- if (context == null ) {
522
+ Activity context = mReactInstanceManagerHelper .getCurrentActivity ();
523
+ if (context == null || context . isFinishing () ) {
523
524
FLog .e (ReactConstants .TAG , "Unable to launch dev options menu because react activity " +
524
525
"isn't available" );
525
526
return ;
You can’t perform that action at this time.
0 commit comments