Commit 3b3b3aeb authored by Edward Wang's avatar Edward Wang

src: Prevent NullPointerException in DirectoryViewFragment.onContextItemSelected()

AdapterContextMenuInfo can be null sometimes, according to the documentation.

Reference:
http://developer.android.com/reference/android/view/MenuItem.html#getMenuInfo%28%29
parent 9eb9494e
......@@ -95,6 +95,9 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
if(info == null) // info can be null
return super.onContextItemSelected(item);
int id = item.getItemId();
String mediaLocation = mDirectoryAdapter.getMediaLocation(info.position);
if(id == R.id.directory_view_play) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment