fix some NPE
This commit is contained in:
parent
abee212bc6
commit
35a37b7370
2 changed files with 14 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue