fixed crash for no author

This commit is contained in:
danijoo
2015-11-05 18:08:09 +01:00
parent c3f35caa6b
commit 3798aabc3c
2 changed files with 7 additions and 2 deletions

View File

@@ -2,4 +2,6 @@
* Fixed NPE if the device is offline
* Fixed missing whitespace in share_text string
* Changed about fragment appearance
* Fixed NPE when rotating device in BookDetail fragment by retaining it
* Fixed NPE when rotating device in BookDetail fragment by retaining it
* Fixed crash if a book has no author

View File

@@ -169,7 +169,10 @@ public class AddBook extends Fragment implements LoaderManager.LoaderCallbacks<C
((TextView) rootView.findViewById(R.id.bookSubTitle)).setText(bookSubTitle);
String authors = data.getString(data.getColumnIndex(AlexandriaContract.AuthorEntry.AUTHOR));
String[] authorsArr = authors.split(",");
if(authors == null)
authors = "";
String[] authorsArr;
authorsArr = authors.split(",");
((TextView) rootView.findViewById(R.id.authors)).setLines(authorsArr.length);
((TextView) rootView.findViewById(R.id.authors)).setText(authors.replace(",","\n"));
String imgUrl = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.IMAGE_URL));