Commit a20eb7a7 authored by Geoffrey Métais's avatar Geoffrey Métais

Network browser: prevent StackOverflowError

(cherry picked from commit 0df40ab0)
parent 5a6c4cdd
......@@ -132,22 +132,16 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Exter
protected boolean handleContextItemSelected(MenuItem item, final int position) {
int id = item.getItemId();
if (! (mAdapter.getItem(position) instanceof MediaWrapper))
return super.onContextItemSelected(item);
if (!(mAdapter.getItem(position) instanceof MediaWrapper)) return false;
final MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
MediaDatabase db;
switch (id){
case R.id.network_add_favorite:
db = MediaDatabase.getInstance();
db.addNetworkFavItem(mw.getUri(), mw.getTitle(), mw.getArtworkURL());
if (isRootDirectory())
updateFavorites();
MediaDatabase.getInstance().addNetworkFavItem(mw.getUri(), mw.getTitle(), mw.getArtworkURL());
if (isRootDirectory()) updateFavorites();
return true;
case R.id.network_remove_favorite:
db = MediaDatabase.getInstance();
db.deleteNetworkFav(mw.getUri());
if (isRootDirectory())
updateFavorites();
MediaDatabase.getInstance().deleteNetworkFav(mw.getUri());
if (isRootDirectory()) updateFavorites();
return true;
case R.id.network_edit_favorite:
showAddServerDialog(mw);
......
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