mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-06-07 15:17:46 +00:00
Merge pull request #1490 from alexbakker/fix-pack-crash
Fix a crash that could occur when deleting a broken icon pack import
This commit is contained in:
commit
e63ec4d1e8
2 changed files with 5 additions and 11 deletions
|
@ -107,15 +107,7 @@ public class IconPacksManagerFragment extends Fragment implements IconPackAdapte
|
|||
.setMessage(R.string.remove_icon_pack_description)
|
||||
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
|
||||
try {
|
||||
_iconPackManager.removeIconPack(pack);
|
||||
} catch (IconPackException e) {
|
||||
e.printStackTrace();
|
||||
Dialogs.showErrorDialog(requireContext(), R.string.icon_pack_delete_error, e);
|
||||
return;
|
||||
}
|
||||
_adapter.removeIconPack(pack);
|
||||
updateEmptyState();
|
||||
removeIconPack(pack);
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.create());
|
||||
|
|
|
@ -35,8 +35,10 @@ public class IconPackAdapter extends RecyclerView.Adapter<IconPackHolder> {
|
|||
|
||||
public void removeIconPack(IconPack pack) {
|
||||
int position = _iconPacks.indexOf(pack);
|
||||
_iconPacks.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
if (position >= 0) {
|
||||
_iconPacks.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue