am a0fd1d74: Fix NPE in RelativeLayout.

Merge commit 'a0fd1d742d8edaf6c7e79bdd16a9b0c44fda4503'

* commit 'a0fd1d742d8edaf6c7e79bdd16a9b0c44fda4503':
  Fix NPE in RelativeLayout.
This commit is contained in:
Romain Guy
2009-06-24 15:45:27 -07:00
committed by The Android Open Source Project

View File

@@ -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;