ソースを参照

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

https://winscp.net/tracker/1585
(cherry picked from commit de7d1a13b0463ec30beb8e4add49c67ac09de8d6)

Source commit: 6e2497486149f1da6564f8124f2dc791dc2baea9
Martin Prikryl 8 年 前
コミット
fdbbdad133
1 ファイル変更12 行追加9 行削除
  1. 12 9
      source/windows/TerminalManager.cpp

+ 12 - 9
source/windows/TerminalManager.cpp

@@ -1280,17 +1280,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()