profile-tab: add checking tab index.
authorminkee.lee <minkee.lee@samsung.com>
Tue, 1 Sep 2015 04:46:37 +0000 (13:46 +0900)
committerminkee Lee <minkee.lee@samsung.com>
Tue, 1 Sep 2015 09:42:45 +0000 (18:42 +0900)
- set index to zero if index < 0

Change-Id: Ifb73b2239590c76a59596a628640edce53b066ec
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/ui/tabfolder/ProfileTabFolder.java

index 08be90e..dedb942 100644 (file)
@@ -58,12 +58,12 @@ public class ProfileTabFolder {
        private static final int RIGHT_BUTTON_HEIGHT    = 18;
        private static final int RIGHT_BUTTON_GAP = 11;
 
-       private ArrayList<ProfileTabItem> items
+       private final ArrayList<ProfileTabItem> items
                                                = new ArrayList<ProfileTabItem>(5);
-       private ArrayList<ImageButton> buttons
+       private final ArrayList<ImageButton> buttons
                                                = new ArrayList<ImageButton>(5);
 
-       private ArrayList<ImageButton> rightButtons
+       private final ArrayList<ImageButton> rightButtons
                                                = new ArrayList<ImageButton>(5);
 
        private Composite mainComposite = null;
@@ -129,11 +129,13 @@ public class ProfileTabFolder {
                                buttons.add(makeTabButton(item));
                        }
 
-                       int index = SettingInfoFile.getLastTapIndex();
-                       if (index >= buttons.size()) {
-                               index = 0;
+                       if (buttons.size() > 0) {
+                               int index = SettingInfoFile.getLastTapIndex();
+                               if (index < 0 || index >= buttons.size()) {
+                                       index = 0;
+                               }
+                               selectionItem(buttons.get(index));
                        }
-                       selectionItem(buttons.get(index));
                }
 
                if(!rightButtons.isEmpty()) {