Skip to content

Commit

Permalink
Fix critical issue that can cause an infinite loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
Si13n7 committed Jun 21, 2018
1 parent 8353939 commit 7a5a6b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/AppsLauncher/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace AppsLauncher
{
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
Expand Down Expand Up @@ -87,13 +88,15 @@ private static void Main()

if (!Arguments.ValidPaths.Any())
return;

IntPtr hWnd;
var stopwatch = new Stopwatch();
stopwatch.Start();
do
{
hWnd = Reg.Read(Settings.RegistryPath, "Handle", IntPtr.Zero);
}
while (hWnd == IntPtr.Zero);
WinApi.NativeHelper.SendArgs(hWnd, Arguments.ValidPathsStr);
while (hWnd == IntPtr.Zero && stopwatch.Elapsed.TotalSeconds <= 10);
if (hWnd != IntPtr.Zero)
WinApi.NativeHelper.SendArgs(hWnd, Arguments.ValidPathsStr);
}
}
}
Expand Down

0 comments on commit 7a5a6b7

Please sign in to comment.