Merge pull request #1294 from mfietz/issue/1293-NPE-MainActivity-onContextItemSelected

Prevent NPE in MainActivity.onContextItemSelected()
This commit is contained in:
Tom Hennen 2015-10-29 17:41:19 -04:00
commit 277cfa01d0
1 changed files with 5 additions and 2 deletions

View File

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