mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-16 06:53:01 +00:00
Check for nulls in intent extra's sent to MainActivity
This commit is contained in:
parent
6ea9502ad1
commit
5cf8f73193
1 changed files with 26 additions and 13 deletions
|
@ -61,6 +61,7 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MainActivity extends AegisActivity implements EntryListView.Listener {
|
||||
// activity request codes
|
||||
|
@ -561,31 +562,43 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
intent.setAction(null);
|
||||
intent.removeExtra(Intent.EXTRA_STREAM);
|
||||
startDecodeQrCodeImages(Collections.singletonList(uri));
|
||||
|
||||
if (uri != null) {
|
||||
startDecodeQrCodeImages(Collections.singletonList(uri));
|
||||
}
|
||||
}
|
||||
if (intent.hasExtra(Intent.EXTRA_TEXT)) {
|
||||
String stringExtra = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
intent.setAction(null);
|
||||
intent.removeExtra(Intent.EXTRA_TEXT);
|
||||
|
||||
GoogleAuthInfo info;
|
||||
try {
|
||||
info = GoogleAuthInfo.parseUri(stringExtra);
|
||||
} catch (GoogleAuthInfoException e) {
|
||||
Dialogs.showErrorDialog(this, R.string.unable_to_process_shared_text, e);
|
||||
break;
|
||||
}
|
||||
if (stringExtra != null) {
|
||||
GoogleAuthInfo info;
|
||||
try {
|
||||
info = GoogleAuthInfo.parseUri(stringExtra);
|
||||
} catch (GoogleAuthInfoException e) {
|
||||
Dialogs.showErrorDialog(this, R.string.unable_to_process_shared_text, e);
|
||||
break;
|
||||
}
|
||||
|
||||
VaultEntry entry = new VaultEntry(info);
|
||||
startEditEntryActivityForNew(CODE_ADD_ENTRY, entry);
|
||||
VaultEntry entry = new VaultEntry(info);
|
||||
startEditEntryActivityForNew(CODE_ADD_ENTRY, entry);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Intent.ACTION_SEND_MULTIPLE:
|
||||
List<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
if (uris != null) {
|
||||
if (intent.hasExtra(Intent.EXTRA_STREAM)) {
|
||||
List<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
intent.setAction(null);
|
||||
intent.removeExtra(Intent.EXTRA_STREAM);
|
||||
startDecodeQrCodeImages(uris);
|
||||
|
||||
if (uris != null) {
|
||||
uris = uris.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
startDecodeQrCodeImages(uris);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue