android: Catch OutOfMemoryError when importing profiles
Not sure if this is actually caused because e.g. the file is too large or due to some encoding issue.
This commit is contained in:
+9
-1
@@ -65,6 +65,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.lang.OutOfMemoryError;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
@@ -715,7 +716,14 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
if (in != null)
|
if (in != null)
|
||||||
{
|
{
|
||||||
result.Profile = streamToString(in);
|
try
|
||||||
|
{
|
||||||
|
result.Profile = streamToString(in);
|
||||||
|
}
|
||||||
|
catch (OutOfMemoryError e)
|
||||||
|
{ /* just use a generic exception */
|
||||||
|
result.ThrownException = new RuntimeException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user