From: David A. Velasco Date: Mon, 10 Sep 2012 08:39:27 +0000 (+0200) Subject: Fixed crashes due to send invalid contents (nulls) to the multiple upload activity... X-Git-Tag: oc-android-1.4.3~186 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/3b0692cb38bd470c5f433133487a5cdee233762e?ds=inline Fixed crashes due to send invalid contents (nulls) to the multiple upload activity from other apps --- diff --git a/src/com/owncloud/android/Uploader.java b/src/com/owncloud/android/Uploader.java index 0505ac9c..b9118667 100644 --- a/src/com/owncloud/android/Uploader.java +++ b/src/com/owncloud/android/Uploader.java @@ -95,8 +95,9 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro getWindow().requestFeature(Window.FEATURE_NO_TITLE); mParents = new Stack(); 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(); 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() {