Browse Source

Merge pull request #414 from rsredsq/RED-EDITOR-313

Fix when editors crashes on nonexistent Android API refresh
JoshEngebretson 10 years ago
parent
commit
44be1e6af1
1 changed files with 12 additions and 0 deletions
  1. 12 0
      Source/ToolCore/Platform/PlatformAndroid.cpp

+ 12 - 0
Source/ToolCore/Platform/PlatformAndroid.cpp

@@ -7,6 +7,7 @@
 
 #include <Atomic/IO/MemoryBuffer.h>
 #include <Atomic/IO/FileSystem.h>
+#include <Atomic/IO/Log.h>
 
 #include "../ToolEnvironment.h"
 #include "../Subprocess/SubprocessSystem.h"
@@ -83,6 +84,17 @@ void PlatformAndroid::RefreshAndroidTargets()
     if (refreshAndroidTargetsProcess_.NotNull())
         return;
 
+    ToolPrefs* prefs = GetSubsystem<ToolEnvironment>()->GetToolPrefs();
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+
+    String androidSDKPath = prefs->GetAndroidSDKPath();
+
+    if (!fileSystem->DirExists(androidSDKPath))
+    {
+        LOGERRORF("The Android SDK path %s does not exist", androidSDKPath.CString());
+        return;
+    }
+
     SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
 
     String androidCommand = GetAndroidCommand();