Skip to content

Commit

Permalink
Work around crashing redbox
Browse files Browse the repository at this point in the history
Summary: When debugging supporting a Fabric component, a redbox was being shown without a title which resulted in an infinite redbox loop, followed by OOM. That isn't helpful so we just safely work around the null title while indicating what happened to aid in debugging.

Reviewed By: lunaleaps

Differential Revision: D16921053

fbshipit-source-id: df1f4a691df0c10de53c91e4a9356a04a9005a97
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed Aug 21, 2019
1 parent b8d6ef3 commit 43f042e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ private FrameViewHolder(View v) {
public StackAdapter(String title, StackFrame[] stack) {
mTitle = title;
mStack = stack;
Assertions.assertNotNull(mTitle);
Assertions.assertNotNull(mStack);
}

@Override
Expand Down Expand Up @@ -169,7 +171,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater.from(parent.getContext())
.inflate(R.layout.redbox_item_title, parent, false);
// Remove ANSI color codes from the title
title.setText(mTitle.replaceAll("\\x1b\\[[0-9;]*m", ""));
String titleSafe = (mTitle == null ? "<unknown title>" : mTitle);
title.setText(titleSafe.replaceAll("\\x1b\\[[0-9;]*m", ""));
return title;
} else {
if (convertView == null) {
Expand Down

0 comments on commit 43f042e

Please sign in to comment.