feed_title substring crash fix

This commit is contained in:
Andrew Dolgov 2012-09-17 23:33:36 +04:00
parent 1a5017b432
commit 84a766213d
2 changed files with 10 additions and 2 deletions

View File

@ -576,7 +576,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (ft != null) { if (ft != null) {
if (article.feed_title != null && (m_feed.is_cat || m_feed.id < 0)) { if (article.feed_title != null && (m_feed.is_cat || m_feed.id < 0)) {
ft.setText(article.feed_title.substring(0, 30));
if (article.feed_title.length() > 20)
ft.setText(article.feed_title.substring(0, 20) + "...");
else
ft.setText(article.feed_title);
} else { } else {
ft.setVisibility(View.GONE); ft.setVisibility(View.GONE);
} }

View File

@ -462,7 +462,10 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
int feedTitleIndex = article.getColumnIndex("feed_title"); int feedTitleIndex = article.getColumnIndex("feed_title");
if (ft != null && feedTitleIndex != -1 && m_feedIsCat) { if (ft != null && feedTitleIndex != -1 && m_feedIsCat) {
String feedTitle = article.getString(feedTitleIndex).substring(0, 30); String feedTitle = article.getString(feedTitleIndex);
if (feedTitle.length() > 20)
feedTitle = feedTitle.substring(0, 20) + "...";
if (feedTitle != null) { if (feedTitle != null) {
ft.setText(feedTitle); ft.setText(feedTitle);