mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 12:51:16 +00:00
Fix NullPointerException for STGUIASSETS
On devices without SD-card / shared-storage, getExternalFilesDir() may return null.
This commit is contained in:
parent
0c7d0431d4
commit
9373a5fd3f
1 changed files with 4 additions and 1 deletions
|
@ -13,6 +13,7 @@ import com.nutomic.syncthingandroid.BuildConfig;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -118,7 +119,9 @@ public class SyncthingRunnable implements Runnable {
|
||||||
// Set home directory to data folder for web GUI folder picker.
|
// Set home directory to data folder for web GUI folder picker.
|
||||||
env.put("HOME", Environment.getExternalStorageDirectory().getAbsolutePath());
|
env.put("HOME", Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||||
env.put("STTRACE", sp.getString("sttrace", ""));
|
env.put("STTRACE", sp.getString("sttrace", ""));
|
||||||
env.put("STGUIASSETS", mContext.getExternalFilesDir(null).getAbsolutePath() + "/gui");
|
File externalFilesDir = mContext.getExternalFilesDir(null);
|
||||||
|
if (externalFilesDir != null)
|
||||||
|
env.put("STGUIASSETS", externalFilesDir.getAbsolutePath() + "/gui");
|
||||||
env.put("STNORESTART", "1");
|
env.put("STNORESTART", "1");
|
||||||
env.put("STNOUPGRADE", "1");
|
env.put("STNOUPGRADE", "1");
|
||||||
if (sp.getBoolean("use_tor", false)) {
|
if (sp.getBoolean("use_tor", false)) {
|
||||||
|
|
Loading…
Reference in a new issue