Skip to content

Commit

Permalink
Fix null pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Scot SCRIVEN authored and Scot SCRIVEN committed Jul 2, 2016
1 parent 7769479 commit 428beb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Binary file modified app/app-release.apk
Binary file not shown.
Expand Up @@ -47,13 +47,16 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
Intent intent = getActivity().getIntent();
mState = (State) intent.getExtras().getSerializable("state");

SpannableStringBuilder txtIngredients = new SpannableStringBuilder(Html.fromHtml(mState.getProduct().getIngredientsText().replace("_","")));
txtIngredients = setSpanBoldBetweenTokens(txtIngredients);
if(!txtIngredients.toString().substring(txtIngredients.toString().indexOf(":")).trim().isEmpty()) {
ingredientsProduct.setText(txtIngredients);
} else {
ingredientsProduct.setVisibility(View.GONE);
if(mState.getProduct().getIngredientsText() != null) {
SpannableStringBuilder txtIngredients = new SpannableStringBuilder(Html.fromHtml(mState.getProduct().getIngredientsText().replace("_","")));
txtIngredients = setSpanBoldBetweenTokens(txtIngredients);
if(!txtIngredients.toString().substring(txtIngredients.toString().indexOf(":")).trim().isEmpty()) {
ingredientsProduct.setText(txtIngredients);
} else {
ingredientsProduct.setVisibility(View.GONE);
}
}

if(!cleanAllergensString().trim().isEmpty()) {
substanceProduct.setText(Html.fromHtml("<b>" + getString(R.string.txtSubstances) + "</b>" + ' ' + cleanAllergensString()));
} else {
Expand Down

0 comments on commit 428beb6

Please sign in to comment.