title: NPE on SolverVariable in ConstraintLayout
body: <p>I've been encountering a weird issue when using ConstraintLayout. I use it with Data Binding.
  The error seems to be happening when some data is null, but I haven't been able to pinpoint exact steps to reproduce.</p>
  
  <p>The app doesn't crash, but I'd love to understand where the exception is coming from.</p>
  
  <p>The stack trace is as below:</p>
  
  <pre><code>04-25 15:32:00.628 25541-25541/gg.matecrate.matecrate W/System.err: java.lang.NullPointerException: Attempt to read from field 'android.support.constraint.solver.SolverVariable android.support.constraint.solver.widgets.ConstraintAnchor.mSolverVariable' on a null object reference
          at android.support.constraint.solver.widgets.Chain.applyChainConstraints(Chain.java:165)
          at android.support.constraint.solver.widgets.Chain.applyChainConstraints(Chain.java:63)
          at android.support.constraint.solver.widgets.ConstraintWidgetContainer.addChildrenToSolver(ConstraintWidgetContainer.java:197)
  04-25 15:32:00.629 25541-25541/gg.matecrate.matecrate W/System.err:     at android.support.constraint.solver.widgets.ConstraintWidgetContainer.layout(ConstraintWidgetContainer.java:360)
          at android.support.constraint.ConstraintLayout.solveLinearSystem(ConstraintLayout.java:1800)
          at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1562)
          at android.view.View.measure(View.java:22002)
          at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1210)
          at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1550)
          at android.view.View.measure(View.java:22002)
          at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1210)
  04-25 15:32:00.630 25541-25541/gg.matecrate.matecrate W/System.err:     at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1550)
          at android.view.View.measure(View.java:22002)
          at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1450)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
  04-25 15:32:00.631 25541-25541/gg.matecrate.matecrate W/System.err:     at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:516)
          at android.view.View.measure(View.java:22002)
          at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1632)
          at android.view.View.measure(View.java:22002)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
          at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:739)
          at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:91)
          at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1361)
          at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:809)
          at android.view.View.measure(View.java:22002)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
          at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
  04-25 15:32:00.632 25541-25541/gg.matecrate.matecrate W/System.err:     at android.view.View.measure(View.java:22002)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
          at android.view.View.measure(View.java:22002)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
          at android.view.View.measure(View.java:22002)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
          at android.view.View.measure(View.java:22002)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
          at com.android.internal.policy.DecorView.onMeasure(DecorView.java:721)
          at android.view.View.measure(View.java:22002)
          at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2410)
          at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1498)
  04-25 15:32:00.633 25541-25541/gg.matecrate.matecrate W/System.err:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751)
          at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
          at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
          at android.view.Choreographer.doCallbacks(Choreographer.java:723)
          at android.view.Choreographer.doFrame(Choreographer.java:658)
          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
          at android.os.Handler.handleCallback(Handler.java:789)
          at android.os.Handler.dispatchMessage(Handler.java:98)
          at android.os.Looper.loop(Looper.java:164)
          at android.app.ActivityThread.main(ActivityThread.java:6541)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  </code></pre>