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,7 +337,11 @@ 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()) {
final Plugin p = failed.get(s);
if (p == null) {
items.add(new SmallEntryItem(s));
} else {
items.add(new SmallEntryItem(p.getDisplayName(), new View.OnClickListener() { items.add(new SmallEntryItem(p.getDisplayName(), new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@@ -345,6 +350,7 @@ public class DeviceFragment extends Fragment {
})); }));
} }
} }
}
ListView buttonsList = (ListView) rootView.findViewById(R.id.buttons_list); ListView buttonsList = (ListView) rootView.findViewById(R.id.buttons_list);
ListAdapter adapter = new ListAdapter(mActivity, items); ListAdapter adapter = new ListAdapter(mActivity, items);