mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Fixed crashes due to send invalid contents (nulls) to the multiple upload activity from other apps
This commit is contained in:
parent
261aaf5001
commit
3b0692cb38
1 changed files with 5 additions and 6 deletions
|
@ -95,8 +95,9 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
|
|||
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
mParents = new Stack<String>();
|
||||
mParents.add("");
|
||||
if (getIntent().hasExtra(Intent.EXTRA_STREAM)) {
|
||||
prepareStreamsToUpload();
|
||||
/*if (getIntent().hasExtra(Intent.EXTRA_STREAM)) {
|
||||
prepareStreamsToUpload();*/
|
||||
if (prepareStreamsToUpload()) {
|
||||
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
|
||||
Account[] accounts = mAccountManager.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);
|
||||
if (accounts.length == 0) {
|
||||
|
@ -370,16 +371,14 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
|
|||
}*/
|
||||
}
|
||||
|
||||
private void prepareStreamsToUpload() {
|
||||
private boolean prepareStreamsToUpload() {
|
||||
if (getIntent().getAction().equals(Intent.ACTION_SEND)) {
|
||||
mStreamsToUpload = new ArrayList<Parcelable>();
|
||||
mStreamsToUpload.add(getIntent().getParcelableExtra(Intent.EXTRA_STREAM));
|
||||
} else if (getIntent().getAction().equals(Intent.ACTION_SEND_MULTIPLE)) {
|
||||
mStreamsToUpload = getIntent().getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
} else {
|
||||
// unknow action inserted
|
||||
throw new IllegalArgumentException("Unknown action given: " + getIntent().getAction());
|
||||
}
|
||||
return (mStreamsToUpload != null && mStreamsToUpload.get(0) != null);
|
||||
}
|
||||
|
||||
public void uploadFiles() {
|
||||
|
|
Loading…
Reference in a new issue