Repository: openfoodfacts/openfoodfacts-androidapp
Issue: CRASH when clicking on deleted product

This happens in the product history when clicking on a deleted product.

```
01-02 13:55:58.344 17934-17934/openfoodfacts.github.scrachx.openfood E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                       Process: openfoodfacts.github.scrachx.openfood, PID: 17934
                                                                                       java.lang.StringIndexOutOfBoundsException: length=13; index=-1
                                                                                           at java.lang.String.indexAndLength(String.java:294)
                                                                                           at java.lang.String.substring(String.java:1067)
                                                                                           at openfoodfacts.github.scrachx.openfood.fragments.IngredientsProductFragment.onViewCreated(IngredientsProductFragment.java:78)
                                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1132)
                                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)
                                                                                           at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
                                                                                           at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1643)
                                                                                           at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:679)
                                                                                           at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
                                                                                           at android.support.v4.view.ViewPager.populate(ViewPager.java:1272)
                                                                                           at android.support.v4.view.ViewPager.populate(ViewPager.java:1120)
                                                                                           at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1646)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                                                           at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                                                                                           at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                                                                                           at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                                                           at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                                                           at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                                                           at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                                                                                           at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                                                                                           at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                                                           at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                                                           at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                                                                                           at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                                                                                           at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                                                           at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                                                           at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
                                                                                           at android.view.View.measure(View.java:18794)
                                                                                           at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
                                                                                           at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
                                                                                           at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1452)
                                                                                           at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
                                                                                           at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
                                                                                           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                                                           at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                                           at android.view.Choreographer.doFrame(Choreographer.java:606)
                                                                                           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                                           at android.os.Handler.handleCallback(Handler.java:739)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                           at android.os.Looper.loop(Looper.java:148)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:5461)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
```

Changed files:
app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/IngredientsProductFragment.java

diff --git a/app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/IngredientsProductFragment.java b/app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/IngredientsProductFragment.java
index 9e6099f12..82729998b 100644
--- a/app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/IngredientsProductFragment.java
+++ b/app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/IngredientsProductFragment.java
@@ -1,6 +1,7 @@
 package openfoodfacts.github.scrachx.openfood.fragments;
 
 import android.content.Intent;
+import android.graphics.Typeface;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.text.Html;
@@ -73,10 +74,10 @@ public class IngredientsProductFragment extends BaseFragment {
         }
 
         if(mState != null && product.getIngredientsText() != null) {
-            SpannableStringBuilder txtIngredients = new SpannableStringBuilder(Html.fromHtml(product.getIngredientsText().replace("_","")));
-            txtIngredients = setSpanBoldBetweenTokens(txtIngredients);
-            if(!txtIngredients.toString().substring(txtIngredients.toString().indexOf(":")).trim().isEmpty()) {
-                ingredientsProduct.setText(txtIngredients);
+            String txtIngredients = product.getIngredientsText().replace("_","").trim();
+            if(!txtIngredients.isEmpty()) {
+                String ingredientsValue = setSpanBoldBetweenTokens(txtIngredients).toString();
+                ingredientsProduct.setText(ingredientsValue);
             } else {
                 ingredientsProduct.setVisibility(View.GONE);
             }
@@ -167,7 +168,7 @@ public class IngredientsProductFragment extends BaseFragment {
             final String tm = m.group();
             for (String l: cleanAllergensMultipleOccurrences()) {
                 if(l.equalsIgnoreCase(tm.replaceAll("[(),.-]+", ""))) {
-                    StyleSpan bold = new StyleSpan(android.graphics.Typeface.BOLD);
+                    StyleSpan bold = new StyleSpan(Typeface.BOLD);
                     if(tm.contains("(")) {
                         ssb.setSpan(bold, m.start()+1, m.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                     } else if(tm.contains(")")) {