瀏覽代碼

Bug 1585: Failure when using Ctrl+Tab keyboard shortcut with no session opened

https://winscp.net/tracker/1585

Source commit: 0d676a809673c55e688add47a6f9a3bcdfc15a9b
Martin Prikryl 8 年之前
父節點
當前提交
de7d1a13b0
共有 1 個文件被更改,包括 12 次插入9 次删除
  1. 12 9
      source/windows/TerminalManager.cpp

+ 12 - 9
source/windows/TerminalManager.cpp

@@ -1302,17 +1302,20 @@ TTerminalQueue * __fastcall TTerminalManager::GetActiveQueue()
 //---------------------------------------------------------------------------
 void __fastcall TTerminalManager::CycleTerminals(bool Forward)
 {
-  int Index = ActiveTerminalIndex;
-  Index += Forward ? 1 : -1;
-  if (Index < 0)
+  if (Count > 0)
   {
-    Index = Count-1;
-  }
-  else if (Index >= Count)
-  {
-    Index = 0;
+    int Index = ActiveTerminalIndex;
+    Index += Forward ? 1 : -1;
+    if (Index < 0)
+    {
+      Index = Count-1;
+    }
+    else if (Index >= Count)
+    {
+      Index = 0;
+    }
+    ActiveTerminalIndex = Index;
   }
-  ActiveTerminalIndex = Index;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TTerminalManager::CanOpenInPutty()