Just check everything for null before you do stuff with it

This commit is contained in:
Martin Fietz 2015-10-25 18:47:51 +01:00
parent c9986edc5e
commit 9dcf3de723
1 changed files with 5 additions and 2 deletions

View File

@ -551,8 +551,11 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
menuInfo = lastMenuInfo;
}
if(menuInfo.targetView.getParent() instanceof ListView == false
|| ((ListView)menuInfo.targetView.getParent()).getId() != R.id.nav_list) {
if(menuInfo == null
|| menuInfo.targetView == null
|| menuInfo.targetView.getParent() == null
|| menuInfo.targetView.getParent() instanceof ListView == false
|| ((ListView)menuInfo.targetView.getParent()).getId() != R.id.nav_list) {
return false;
}
final int position = menuInfo.position;