More paranoia from Google Play

This commit is contained in:
Henrik Rydgård 2018-05-27 22:16:36 +02:00
parent b730d187e8
commit 343763cf5a
2 changed files with 11 additions and 2 deletions

View File

@ -323,6 +323,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
}
std::string GetJavaString(JNIEnv *env, jstring jstr) {
if (!jstr)
return "";
const char *str = env->GetStringUTFChars(jstr, 0);
std::string cpp_string = std::string(str);
env->ReleaseStringUTFChars(jstr, str);
@ -397,7 +399,9 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init
langRegion = GetJavaString(env, jlangRegion);
std::string externalDir = GetJavaString(env, jexternalDir);
std::string user_data_path = GetJavaString(env, jdataDir) + "/";
std::string user_data_path = GetJavaString(env, jdataDir);
if (user_data_path.size() > 0)
user_data_path += "/";
library_path = GetJavaString(env, jlibraryDir) + "/";
std::string shortcut_param = GetJavaString(env, jshortcutParam);
std::string cacheDir = GetJavaString(env, jcacheDir);

View File

@ -296,7 +296,12 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
File sdcard = Environment.getExternalStorageDirectory();
String externalStorageDir = sdcard.getAbsolutePath();
String dataDir = this.getFilesDir().getAbsolutePath();
File filesDir = this.getFilesDir();
String dataDir = null;
if (filesDir != null) {
// Null has been seen in Google Play stacktraces
dataDir = this.getFilesDir().getAbsolutePath();
}
String apkFilePath = appInfo.sourceDir;
String cacheDir = getCacheDir().getAbsolutePath();