TOOLS: Fixed a bug whrer arrary index exception occurs when user open context menu... 86/16986/2
authorshingil.kang <shingil.kang@samsung.com>
Fri, 28 Feb 2014 06:39:40 +0000 (15:39 +0900)
committershingil.kang <shingil.kang@samsung.com>
Sun, 2 Mar 2014 07:46:57 +0000 (16:46 +0900)
Change-Id: I576bdd5fb26d4eb2bf9606c402d3fe54c75b5400
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorer.java

index ee7215a..baf4e76 100755 (executable)
@@ -547,10 +547,18 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2
 
     private int isPlatformLogOn()
     {
-        TreeItem[] items = panel.getTreeViewer().getTree().getSelection();
+        final AtomicInteger result = new AtomicInteger(PLATFORMLOG_UNABLE);
+        Tree tree = panel.getTreeViewer().getTree();
+
+        // if no item is selected in tree, return default value;
+        if(tree.getSelectionCount() == 0)
+        {
+            return result.get();
+        }
+        TreeItem[] items = tree.getSelection();
         FileEntry file = (FileEntry) items[0].getData();
         IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
-        final AtomicInteger result = new AtomicInteger(PLATFORMLOG_UNABLE);
+
         for (IDevice device : devices)
         {
             if (file.getName().equals(device.getDeviceName()))
@@ -845,4 +853,4 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2
             }
         }
     }
-}
\ No newline at end of file
+}