- LinkedList<AltosDeviceLinux> subset = new LinkedList<AltosDeviceLinux>();
- for (int i = 0; i < devices.length; i++) {
- if (devices[i].product.startsWith(model))
- subset.add(devices[i]);
+ if (model != null) {
+ LinkedList<AltosDeviceLinux> subset = new LinkedList<AltosDeviceLinux>();
+ for (int i = 0; i < devices.length; i++) {
+ if (devices[i].product.startsWith(model))
+ subset.add(devices[i]);
+ }
+ devices = new AltosDeviceLinux[subset.size()];
+ for (int e = 0; e < subset.size(); e++)
+ devices[e] = subset.get(e);