Skip to content

Commit

Permalink
Merge pull request #95 from tygalive/master
Browse files Browse the repository at this point in the history
Fix Null pointer Exceptions
  • Loading branch information
richard-muvirimi committed May 3, 2021
2 parents 7c17e35 + 2e27415 commit 9925dcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public final class VisibleUtil {

public static void handle(@NonNull View v, @Nullable String s) {
public static void handle(@NonNull View v, @Nullable CharSequence s) {
v.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.cardview.widget.CardView;

import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -118,13 +119,13 @@ public void build(@NonNull AboutBuilder bundle) {
setupCard(bundle);

tvName.setText(bundle.getName());
VisibleUtil.handle(tvName, bundle.getName().toString());
VisibleUtil.handle(tvName, bundle.getName());

tvSubTitle.setText(bundle.getSubTitle());
VisibleUtil.handle(tvSubTitle, bundle.getSubTitle().toString());
VisibleUtil.handle(tvSubTitle, bundle.getSubTitle());

tvBrief.setText(bundle.getBrief());
VisibleUtil.handle(tvBrief, bundle.getBrief().toString());
VisibleUtil.handle(tvBrief, bundle.getBrief());

tvAppName.setText(bundle.getAppName());
tvAppTitle.setText(bundle.getAppTitle());
Expand All @@ -138,7 +139,7 @@ public void build(@NonNull AboutBuilder bundle) {
if (bundle.getBackgroundColor() != 0)
cvHolder.setCardBackgroundColor(bundle.getBackgroundColor());

VisibleUtil.handle(appHolder, bundle.getAppName().toString());
VisibleUtil.handle(appHolder, bundle.getAppName());

if (appHolder.getVisibility() == VISIBLE)
setDivider(bundle, appHolder);
Expand Down

0 comments on commit 9925dcd

Please sign in to comment.