diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
index 5357306db..ab7f987a6 100644
--- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
+++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
@@ -489,8 +489,10 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
for (Account.Role role : account.roles) {
TextView roleText = new TextView(getActivity(), null, 0, R.style.role_label);
roleText.setText(role.name);
- GradientDrawable bg = (GradientDrawable) roleText.getBackground().mutate();
- bg.setStroke(V.dp(2), Color.parseColor(role.color));
+ if (!TextUtils.isEmpty(role.color) && role.color.startsWith("#")) try {
+ GradientDrawable bg = (GradientDrawable) roleText.getBackground().mutate();
+ bg.setStroke(V.dp(2), Color.parseColor(role.color));
+ } catch (Exception ignored) {}
rolesView.addView(roleText);
}
}
diff --git a/mastodon/src/main/res/drawable/bg_pill.xml b/mastodon/src/main/res/drawable/bg_pill.xml
index af6a69a4f..d2318453f 100644
--- a/mastodon/src/main/res/drawable/bg_pill.xml
+++ b/mastodon/src/main/res/drawable/bg_pill.xml
@@ -4,5 +4,5 @@
android:shape="rectangle">
-
+
\ No newline at end of file