Skip to content

Commit

Permalink
Add logging in ReactInstanceManager.onHostPause when activity is inco…
Browse files Browse the repository at this point in the history
…rrectly null (#48226)

Summary:
Pull Request resolved: #48226

Adding logging to onHostPause to help diagnose cases when the activity is incorrectly null.

Reviewed By: fkgozali

Differential Revision: D67123351

fbshipit-source-id: f694a3a89e4584776050f6bca2f33f2805528d4b
  • Loading branch information
Maddie Lord authored and facebook-github-bot committed Dec 13, 2024
1 parent 81c74cd commit c2fd35a
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,16 @@ public void onUserLeaveHint(@Nullable Activity activity) {
@ThreadConfined(UI)
public void onHostPause(@Nullable Activity activity) {
if (mRequireActivity) {
if (mCurrentActivity == null) {
String message =
"ReactInstanceManager.onHostPause called with null activity, expected:"
+ mCurrentActivity.getClass().getSimpleName();
FLog.e(TAG, message);
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
for (StackTraceElement element : stackTrace) {
FLog.e(TAG, element.toString());
}
}
Assertions.assertCondition(mCurrentActivity != null);
}
if (mCurrentActivity != null) {
Expand Down

0 comments on commit c2fd35a

Please sign in to comment.