mirror of
https://codeberg.org/gitnex/GitNex
synced 2024-12-23 00:48:57 +01:00
Fix crash if wiki page has no title (#1210)
Close https://codeberg.org/gitnex/GitNex/issues/1204 The issue is not an empty wiki, but an empty title. Don't know *how* this can happen, but it *can* happen (I have one example in my local gitea). Co-authored-by: qwerty287 <ndev@web.de> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1210 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org> Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
parent
6e3877580e
commit
385147f235
@ -220,10 +220,14 @@ public class WikiListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
|
||||
ColorGenerator generator = ColorGenerator.Companion.getMATERIAL();
|
||||
int color = generator.getColor(wikiPageMetaData.getTitle());
|
||||
if (wikiPageMetaData.getTitle() != null && wikiPageMetaData.getTitle().length() > 0) {
|
||||
String firstCharacter = String.valueOf(wikiPageMetaData.getTitle().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 14);
|
||||
avatar.setImageDrawable(drawable);
|
||||
} else {
|
||||
avatar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!((RepoDetailActivity) ctx).repository.getPermissions().isPush()) {
|
||||
wikiMenu.setVisibility(View.GONE);
|
||||
|
Loading…
Reference in New Issue
Block a user