OSDN Git Service

SDK: fix NPE in AVD Manager > Start when skin.path is missing.
authorRaphael <raphael@google.com>
Fri, 6 Nov 2009 21:42:28 +0000 (13:42 -0800)
committerRaphael <raphael@google.com>
Fri, 6 Nov 2009 21:42:28 +0000 (13:42 -0800)
Change-Id: I0e42d3f110cfc4e313972f3021b7d2d84dfbd64d

sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java

index b698b64..720ee12 100644 (file)
@@ -424,6 +424,7 @@ final class AvdStartDialog extends GridDialog {
                 mSize2 = Integer.parseInt(m.group(2));
                 mSkinDisplay = skinName;
                 mEnableScaling = true;
+                return;
             }
         }
 
@@ -431,15 +432,18 @@ final class AvdStartDialog extends GridDialog {
         mEnableScaling = false; // default to false for now.
 
         // path to the skin layout file.
-        File skinFolder = new File(mSdkLocation, prop.get(AvdManager.AVD_INI_SKIN_PATH));
-        if (skinFolder.isDirectory()) {
-            File layoutFile = new File(skinFolder, "layout");
-            if (layoutFile.isFile()) {
-                if (parseLayoutFile(layoutFile)) {
-                    mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2);
-                    mEnableScaling = true;
-                } else {
-                    mSkinDisplay = skinName;
+        String skinPath = prop.get(AvdManager.AVD_INI_SKIN_PATH);
+        if (skinPath != null) {
+            File skinFolder = new File(mSdkLocation, skinPath);
+            if (skinFolder.isDirectory()) {
+                File layoutFile = new File(skinFolder, "layout");
+                if (layoutFile.isFile()) {
+                    if (parseLayoutFile(layoutFile)) {
+                        mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2);
+                        mEnableScaling = true;
+                    } else {
+                        mSkinDisplay = skinName;
+                    }
                 }
             }
         }