android/ipn: ignore shared files we have no access to

I'm not able to reproduce the crash described in #2720; sharing files
from an SD-card through taildrop works for me (ChromeOS 93.0) without
issues. However, this change makes sure that we don't crash should we
lack permission for some reason.

Updates tailscale/tailscale#2720

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/20/head
Elias Naur 3 years ago
parent db77216ead
commit f37cf72d81

@ -69,6 +69,10 @@ public final class IPNActivity extends Activity {
nfiles++;
} else if (uri != null) {
Cursor c = getContentResolver().query(uri, null, null, null, null);
if (c == null) {
// Ignore files we have no permission to access.
continue;
}
int nameCol = c.getColumnIndex(OpenableColumns.DISPLAY_NAME);
int sizeCol = c.getColumnIndex(OpenableColumns.SIZE);
c.moveToFirst();

Loading…
Cancel
Save