mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fix crash when trying to edit individual file name in multiple upload
Don't try to disable menu items when they don't exist
This commit is contained in:
parent
1be36cb16c
commit
0e1297fe45
1 changed files with 9 additions and 9 deletions
|
|
@ -138,15 +138,15 @@ public class MediaDetailPagerFragment extends SherlockFragment implements ViewPa
|
||||||
if(!editable) { // Disable menu options for editable views
|
if(!editable) { // Disable menu options for editable views
|
||||||
menu.clear(); // see http://stackoverflow.com/a/8495697/17865
|
menu.clear(); // see http://stackoverflow.com/a/8495697/17865
|
||||||
inflater.inflate(R.menu.fragment_image_detail, menu);
|
inflater.inflate(R.menu.fragment_image_detail, menu);
|
||||||
}
|
if(pager != null) {
|
||||||
if(pager != null) {
|
MediaDetailProvider provider = (MediaDetailProvider)getSherlockActivity();
|
||||||
MediaDetailProvider provider = (MediaDetailProvider)getSherlockActivity();
|
Media m = provider.getMediaAtPosition(pager.getCurrentItem());
|
||||||
Media m = provider.getMediaAtPosition(pager.getCurrentItem());
|
if(m != null && !m.getFilename().startsWith("File:")) {
|
||||||
if(m != null && !m.getFilename().startsWith("File:")) {
|
// Crude way of checking if the file has been successfully saved!
|
||||||
// Crude way of checking if the file has been successfully saved!
|
menu.findItem(R.id.menu_browser_current_image).setEnabled(false);
|
||||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(false);
|
menu.findItem(R.id.menu_share_current_image).setEnabled(false);
|
||||||
menu.findItem(R.id.menu_share_current_image).setEnabled(false);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue