if nothing received to upload, app crashed

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-02-28 15:13:48 +01:00 committed by AndyScherzinger
parent 2fe9db5146
commit c9634022d2
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -192,22 +192,23 @@ public class ReceiveExternalFilesActivity extends FileActivity
@Override
protected void setAccount(Account account, boolean savedAccount) {
if (somethingToUpload()) {
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = mAccountManager.getAccountsByType(MainApp.getAccountType());
if (accounts.length == 0) {
Log_OC.i(TAG, "No ownCloud account is available");
DialogNoAccount dialog = new DialogNoAccount();
dialog.show(getSupportFragmentManager(), null);
} else {
if (!savedAccount) {
setAccount(accounts[0]);
}
}
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = mAccountManager.getAccountsByType(MainApp.getAccountType());
if (accounts.length == 0) {
Log_OC.i(TAG, "No ownCloud account is available");
DialogNoAccount dialog = new DialogNoAccount();
dialog.show(getSupportFragmentManager(), null);
} else {
if (!savedAccount) {
setAccount(accounts[0]);
}
}
if (!somethingToUpload()) {
showErrorDialog(
R.string.uploader_error_message_no_file_to_upload,
R.string.uploader_error_title_no_file_to_upload
R.string.uploader_error_message_no_file_to_upload,
R.string.uploader_error_title_no_file_to_upload
);
}