aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/ActionBarActivity.java12
2 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 8fb5aa406..39c743185 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -433,11 +433,13 @@ public class FileBackend {
is = mXmppConnectionService.getContentResolver().openInputStream(uri);
byte[] buffer = new byte[1024];
int length;
- while ((length = is.read(buffer)) > 0) {
+ while ((length = is != null ? is.read(buffer) : 0) > 0) {
try {
os.write(buffer, 0, length);
} catch (IOException e) {
throw new FileWriterException();
+ } catch (Exception e) {
+ throw new FileWriterException();
}
}
try {
@@ -452,6 +454,9 @@ public class FileBackend {
} catch (IOException e) {
e.printStackTrace();
throw new FileCopyException(R.string.error_io_exception);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new FileCopyException(R.string.error_unable_to_create_temporary_file);
} finally {
close(os);
close(is);
diff --git a/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java b/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java
index cab311d58..0bd0c78c7 100644
--- a/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java
@@ -33,10 +33,14 @@ public abstract class ActionBarActivity extends AppCompatActivity {
}
void initializeScreenshotSecurity() {
- if (isScreenSecurityEnabled()) {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
- } else {
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ try {
+ if (isScreenSecurityEnabled()) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ } else {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
}
}