fix: Prevent invalid map bounds #123

This commit is contained in:
Janez T
2026-03-16 22:16:36 +01:00
parent cfd233d38e
commit 993563f059
11 changed files with 129 additions and 25 deletions

View File

@@ -169,8 +169,13 @@ class _DiscoveryScreenState extends State<DiscoveryScreen> {
});
try {
final contactsProvider = context.read<ContactsProvider>();
for (final advert in adverts) {
if (!mounted) break;
// Skip already-resolved contacts
if (contactsProvider.findContactByKey(advert.publicKey) != null) {
continue;
}
await _resolveAdvert(advert);
}
} finally {

View File

@@ -980,7 +980,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
builder: (context) => SimpleDialog(
title: const Text('Route path byte size'),
children: [
for (final value in [1, 2, 3])
for (final value in RouteHashPreferences.supportedSizes)
SimpleDialogOption(
onPressed: () => Navigator.of(context).pop(value),
child: Row(
@@ -990,7 +990,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('$value byte${value == 1 ? '' : 's'}'),
Text('$value-byte (max ${64 ~/ value} hops)'),
Text(
'Use ${value * 2} hex characters per hop',
style: Theme.of(context).textTheme.bodySmall,