2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Do not assume that all the plugins are non-null

This commit is contained in:
Albert Vaca
2015-09-12 07:17:14 -07:00
parent 629b38dec9
commit 6940bac3e6

View File

@@ -49,6 +49,7 @@ import org.kde.kdeconnect_tp.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
import java.util.HashMap;
/** /**
@@ -321,7 +322,7 @@ public class DeviceFragment extends Fragment {
} }
//Failed plugins List //Failed plugins List
final Collection<Plugin> failed = device.getFailedPlugins().values(); final HashMap<String, Plugin> failed = device.getFailedPlugins();
if (!failed.isEmpty()) { if (!failed.isEmpty()) {
if (errorHeader == null) { if (errorHeader == null) {
errorHeader = new TextView(mActivity); errorHeader = new TextView(mActivity);
@@ -336,13 +337,18 @@ public class DeviceFragment extends Fragment {
errorHeader.setText(getResources().getString(R.string.plugins_failed_to_load)); errorHeader.setText(getResources().getString(R.string.plugins_failed_to_load));
} }
items.add(new CustomItem(errorHeader)); items.add(new CustomItem(errorHeader));
for (final Plugin p : failed) { for (String s : failed.keySet()) {
items.add(new SmallEntryItem(p.getDisplayName(), new View.OnClickListener() { final Plugin p = failed.get(s);
@Override if (p == null) {
public void onClick(View v) { items.add(new SmallEntryItem(s));
p.getErrorDialog(mActivity).show(); } else {
} items.add(new SmallEntryItem(p.getDisplayName(), new View.OnClickListener() {
})); @Override
public void onClick(View v) {
p.getErrorDialog(mActivity).show();
}
}));
}
} }
} }