mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-16 15:02:54 +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.Objects;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class MainActivity extends AegisActivity implements EntryListView.Listener {
|
public class MainActivity extends AegisActivity implements EntryListView.Listener {
|
||||||
// activity request codes
|
// activity request codes
|
||||||
|
@ -561,31 +562,43 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
||||||
uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
intent.setAction(null);
|
intent.setAction(null);
|
||||||
intent.removeExtra(Intent.EXTRA_STREAM);
|
intent.removeExtra(Intent.EXTRA_STREAM);
|
||||||
startDecodeQrCodeImages(Collections.singletonList(uri));
|
|
||||||
|
if (uri != null) {
|
||||||
|
startDecodeQrCodeImages(Collections.singletonList(uri));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (intent.hasExtra(Intent.EXTRA_TEXT)) {
|
if (intent.hasExtra(Intent.EXTRA_TEXT)) {
|
||||||
String stringExtra = intent.getStringExtra(Intent.EXTRA_TEXT);
|
String stringExtra = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
intent.setAction(null);
|
intent.setAction(null);
|
||||||
intent.removeExtra(Intent.EXTRA_TEXT);
|
intent.removeExtra(Intent.EXTRA_TEXT);
|
||||||
|
|
||||||
GoogleAuthInfo info;
|
if (stringExtra != null) {
|
||||||
try {
|
GoogleAuthInfo info;
|
||||||
info = GoogleAuthInfo.parseUri(stringExtra);
|
try {
|
||||||
} catch (GoogleAuthInfoException e) {
|
info = GoogleAuthInfo.parseUri(stringExtra);
|
||||||
Dialogs.showErrorDialog(this, R.string.unable_to_process_shared_text, e);
|
} catch (GoogleAuthInfoException e) {
|
||||||
break;
|
Dialogs.showErrorDialog(this, R.string.unable_to_process_shared_text, e);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
VaultEntry entry = new VaultEntry(info);
|
VaultEntry entry = new VaultEntry(info);
|
||||||
startEditEntryActivityForNew(CODE_ADD_ENTRY, entry);
|
startEditEntryActivityForNew(CODE_ADD_ENTRY, entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Intent.ACTION_SEND_MULTIPLE:
|
case Intent.ACTION_SEND_MULTIPLE:
|
||||||
List<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
if (intent.hasExtra(Intent.EXTRA_STREAM)) {
|
||||||
if (uris != null) {
|
List<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||||
intent.setAction(null);
|
intent.setAction(null);
|
||||||
intent.removeExtra(Intent.EXTRA_STREAM);
|
intent.removeExtra(Intent.EXTRA_STREAM);
|
||||||
startDecodeQrCodeImages(uris);
|
|
||||||
|
if (uris != null) {
|
||||||
|
uris = uris.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
startDecodeQrCodeImages(uris);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue