Avoid possible NPE

This commit is contained in:
tonymanou 2017-01-09 20:08:37 +01:00 committed by topjohnwu
parent 0b59bb1a29
commit 2cabb2666b

View File

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
@ -92,7 +93,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
}
});
holder.changeLog.setOnClickListener(view -> {
if (!repo.getLogUrl().isEmpty()) {
if (!TextUtils.isEmpty(repo.getLogUrl())) {
new WebWindow(mContext.getString(R.string.changelog), repo.getLogUrl(), mContext);
}
});
@ -111,12 +112,12 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
.show();
});
holder.authorLink.setOnClickListener(view -> {
if (!repo.getDonateUrl().isEmpty()) {
if (!TextUtils.isEmpty(repo.getDonateUrl())) {
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getDonateUrl())));
}
});
holder.supportLink.setOnClickListener(view -> {
if (!repo.getSupportUrl().isEmpty()) {
if (!TextUtils.isEmpty(repo.getSupportUrl())) {
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getSupportUrl())));
}
});