Fix NPE in CandidateView.offsetMargin

Bug: 4609124
Change-Id: I14913afba80732e6beb8458b404001798a221a79
main
Tadashi G. Takaoka 2011-06-15 10:48:53 +09:00
parent 86e815a142
commit 862e05a8f0
1 changed files with 2 additions and 0 deletions

View File

@ -363,6 +363,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
} }
private static void offsetMargin(View v, int dx, int dy) { private static void offsetMargin(View v, int dx, int dy) {
if (v == null)
return;
ViewGroup.LayoutParams lp = v.getLayoutParams(); ViewGroup.LayoutParams lp = v.getLayoutParams();
if (lp instanceof ViewGroup.MarginLayoutParams) { if (lp instanceof ViewGroup.MarginLayoutParams) {
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams)lp; ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams)lp;