Avoid crashes when content is null for tag tabs

This commit is contained in:
stom79 2018-09-03 11:21:17 +02:00
parent 8decfff818
commit 5a872552ce
1 changed files with 4 additions and 4 deletions

View File

@ -1720,11 +1720,11 @@ public abstract class BaseMainActivity extends BaseActivity
public void onClick(DialogInterface dialog, int id) {
new SearchDAO(BaseMainActivity.this, db).remove(title);
String tag;
if( position > 0)
tag = tabLayout.getTabAt(position -1).getText().toString();
else if( tabLayout.getTabCount() > 1 )
if( position > 0 && tabLayout.getTabAt(position - 1).getText() != null) {
tag = tabLayout.getTabAt(position - 1).getText().toString();
}else if( tabLayout.getTabCount() > 1 && tabLayout.getTabAt(1).getText() != null) {
tag = tabLayout.getTabAt(1).getText().toString();
else //Last element
}else //Last element
tag = "";
Helper.removeTab(tabLayout, adapter, position);
adapter = new BaseMainActivity.PagerAdapter