From bdafa86e0a452c6166ee764005eb84239c92e853 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Sat, 25 Mar 2023 11:15:09 +0800 Subject: [PATCH] fix: shortcut not working due to range error --- flutter/lib/common.dart | 6 +++--- flutter/lib/main.dart | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index f0fb00c2b..1b6afd584 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1522,14 +1522,14 @@ bool checkArguments() { return false; } String? id = - kBootArgs.length < connectIndex + 1 ? null : kBootArgs[connectIndex + 1]; + kBootArgs.length <= connectIndex + 1 ? null : kBootArgs[connectIndex + 1]; String? password = - kBootArgs.length < connectIndex + 2 ? null : kBootArgs[connectIndex + 2]; + kBootArgs.length <= connectIndex + 2 ? null : kBootArgs[connectIndex + 2]; if (password != null && password.startsWith("--")) { password = null; } final switchUuidIndex = kBootArgs.indexOf("--switch_uuid"); - String? switchUuid = kBootArgs.length < switchUuidIndex + 1 + String? switchUuid = kBootArgs.length <= switchUuidIndex + 1 ? null : kBootArgs[switchUuidIndex + 1]; if (id != null) { diff --git a/flutter/lib/main.dart b/flutter/lib/main.dart index f0a9a938f..164de04d6 100644 --- a/flutter/lib/main.dart +++ b/flutter/lib/main.dart @@ -134,10 +134,9 @@ void runMainApp(bool startService) async { await restoreWindowPosition(WindowType.Main); // Check the startup argument, if we successfully handle the argument, we keep the main window hidden. final handledByUniLinks = await initUniLinks(); - final handledByCli = checkArguments(); debugPrint( - "handled by uni links: $handledByUniLinks, handled by cli: $handledByCli"); - if (handledByUniLinks || handledByCli) { + "handled by uni links: $handledByUniLinks"); + if (handledByUniLinks || checkArguments()) { windowManager.hide(); } else { windowManager.show();