java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference


Solutions on the web

Solution icon of github
Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference

Solution icon of github
Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference

Stack trace

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
	at openfoodfacts.github.scrachx.openfood.fragments.NutritionProductFragment.localiseNutritionLevel(NutritionProductFragment.java:137)
	at openfoodfacts.github.scrachx.openfood.fragments.NutritionProductFragment.onViewCreated(NutritionProductFragment.java:53)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1127)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
	at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
	at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1638)
	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:1240)
	at android.support.v4.view.ViewPager.populate(ViewPager.java:1088)
	at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5715)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5715)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
	at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5715)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5715)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5715)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5715)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2728)
	at android.view.View.measure(View.java:17915)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2412)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1414)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1638)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1292)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6598)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
	at android.view.Choreographer.doCallbacks(Choreographer.java:603)
	at android.view.Choreographer.doFrame(Choreographer.java:572)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
	at android.os.Handler.handleCallback(Handler.java:815)
	at android.os.Handler.dispatchMessage(Handler.java:104)
	at android.os.Looper.loop(Looper.java:194)
	at android.app.ActivityThread.main(ActivityThread.java:5631)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.