fix: exception when there is no active profile

This commit is contained in:
Hiddify
2024-02-22 10:04:21 +01:00
parent 4347789504
commit 59ca9ff475

View File

@@ -119,9 +119,13 @@ class ConnectionNotifier extends _$ConnectionNotifier with AppLogger {
Future<void> _connect() async { Future<void> _connect() async {
final activeProfile = await ref.read(activeProfileProvider.future); final activeProfile = await ref.read(activeProfileProvider.future);
if (activeProfile == null) {
loggy.info("no active profile, not connecting");
return;
}
await _connectionRepo await _connectionRepo
.connect( .connect(
activeProfile!.id, activeProfile.id,
activeProfile.name, activeProfile.name,
ref.read(disableMemoryLimitProvider), ref.read(disableMemoryLimitProvider),
) )