Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95c92cbf authored by Scott Mertz's avatar Scott Mertz
Browse files

Fix crash when long press directory

When long pressing a directory, the actions dialog will build an FSO
send intent to query if it can be handled by any application.  In this
case, the list of URIs to share will be 0, causing the crash.

FEIJ-1439
Change-Id: I3f500916774af4bde939bd42060d92070971663a
parent 70addacb
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -192,7 +192,6 @@ public final class IntentsActionPolicy extends ActionsPolicy {

    private static Intent getFsoSendIntent(final Context ctx, final List<FileSystemObject> fsos) {
        Intent intent = new Intent();
        intent.setAction(fsos.size() > 1 ? Intent.ACTION_SEND_MULTIPLE : Intent.ACTION_SEND);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

        // Create an array list of the uris to send
@@ -229,10 +228,12 @@ public final class IntentsActionPolicy extends ActionsPolicy {
                intent.setType(MimeTypeHelper.ALL_MIME_TYPES);
            }
        }
        if (uris.size() > 1) {
            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        } else {
        if (uris.size() == 1) {
            intent.setAction(Intent.ACTION_SEND);
            intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
        } else {
            intent.setAction(Intent.ACTION_SEND_MULTIPLE);
            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        }
        return intent;
    }