diff options
| author | 2009-06-24 14:25:43 -0700 | |
|---|---|---|
| committer | 2009-06-24 14:25:43 -0700 | |
| commit | a0fd1d742d8edaf6c7e79bdd16a9b0c44fda4503 (patch) | |
| tree | 874800d4ed5820b70818ece10eb010cefc677d78 | |
| parent | e181409ced966f2bea6128bf32b0334e34fcf58c (diff) | |
Fix NPE in RelativeLayout.
| -rw-r--r-- | core/java/android/widget/RelativeLayout.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index b2aa57420969..1f63e117a947 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -764,18 +764,16 @@ public class RelativeLayout extends ViewGroup { private View getRelatedView(int[] rules, int relation) { int id = rules[relation]; if (id != 0) { - View v = mGraph.mNodes.get(id).view; - if (v == null) { - return null; - } + DependencyGraph.Node node = mGraph.mNodes.get(id); + if (node == null) return null; + View v = node.view; // Find the first non-GONE view up the chain while (v.getVisibility() == View.GONE) { rules = ((LayoutParams) v.getLayoutParams()).getRules(); - v = mGraph.mNodes.get((rules[relation])).view; - if (v == null) { - return null; - } + node = mGraph.mNodes.get((rules[relation])); + if (node == null) return null; + v = node.view; } return v; |