micropeak: Note when libaltos fails
authorKeith Packard <keithp@keithp.com>
Fri, 11 Jan 2013 05:42:23 +0000 (21:42 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 11 Jan 2013 05:48:31 +0000 (21:48 -0800)
Not getting any device list back from MicroUSB means the library
wasn't found, so pop up a dialog box explaining the situation.

Signed-off-by: Keith Packard <keithp@keithp.com>
micropeak/MicroDeviceDialog.java

index 7b8a630c83a8a24280b066855049e0fb13a0ba11..23195dac135a50d5b24ea78b80d0020afd649e53 100644 (file)
@@ -27,6 +27,15 @@ public class MicroDeviceDialog extends AltosDeviceDialog {
 
        public AltosDevice[] devices() {
                java.util.List<MicroUSB>        list = MicroUSB.list();
+
+               if (list == null) {
+                       JOptionPane.showMessageDialog(frame,
+                                                     "libaltos failed to load",
+                                                     "Helper Library Failed",
+                                                     JOptionPane.ERROR_MESSAGE);
+                       return new AltosDevice[0];
+               }
+
                int             num_devices = list.size();
                AltosDevice[]   devices = new AltosDevice[num_devices];