Fix resource not found exception with null checks (#1628)

This commit is contained in:
Vivek Maskara 2018-06-14 14:42:46 +05:30 committed by Josephine Lim
parent 2e9af3c33a
commit 1dc0a7c257

View file

@ -275,17 +275,25 @@ public class ContributionsActivity
.getUploadCount(sessionManager.getCurrentAccount().name)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
uploadCount -> getSupportActionBar().setSubtitle(getResources()
.getQuantityString(R.plurals.contributions_subtitle,
uploadCount, uploadCount)),
.subscribe(this::displayUploadCount,
t -> Timber.e(t, "Fetching upload count failed")
));
}
public void betaSetUploadCount(int betaUploadCount){
private void displayUploadCount(Integer uploadCount) {
if (isFinishing()
|| getSupportActionBar() == null
|| getResources() == null) {
return;
}
getSupportActionBar().setSubtitle(getResources()
.getQuantityString(R.plurals.contributions_subtitle, betaUploadCount, betaUploadCount));
.getQuantityString(R.plurals.contributions_subtitle,
uploadCount, uploadCount));
}
public void betaSetUploadCount(int betaUploadCount) {
displayUploadCount(betaUploadCount);
}