Skip to content

Commit

Permalink
Fix player build and process lurker
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Dec 8, 2024
1 parent 4d210e0 commit 11fa41b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/PoeLurker.Core/PoeLurker.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="NAudio" Version="2.2.1" />
<PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="PoeLurker.Patreon" Version="8.0.17" />
<PackageReference Include="ProcessLurker" Version="8.0.0" />
<PackageReference Include="ProcessLurker" Version="8.0.1" />
<PackageReference Include="SharpClipboard" Version="3.5.2" />
<PackageReference Include="TextCopy" Version="6.2.1" />
<PackageReference Include="Winook" Version="1.3.2" />
Expand Down
2 changes: 1 addition & 1 deletion src/PoeLurker.UI/ViewModels/BuildViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public BuildViewModel(IWindowManager windowManager, DockingHelper dockingHelper,

_mouseLurker = mouseLurker;

if (_activePlayer != null && !string.IsNullOrEmpty(_activePlayer.Build.BuildId))
if (_activePlayer != null && _activePlayer.Build != null && !string.IsNullOrEmpty(_activePlayer.Build.BuildId))
{
var build = buildService.Builds.FirstOrDefault(b => b.Id == _activePlayer.Build.BuildId);
if (build == null)
Expand Down
10 changes: 5 additions & 5 deletions src/PoeLurker.UI/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -684,23 +684,23 @@ private async Task WaitForPoe(bool fromClosing)
_processLurker = new PathOfExileProcessLurker();
var existingProcess = _processLurker.GetProcess();
_processLurker.ProcessClosed += PoeClosed;
var windowHandle = await _processLurker.WaitForProcess();
var processId = await _processLurker.WaitForProcess(waitForExit: true, waitForWindowHandle: true, timeout: 0);

_currentLurker = new ClientLurker(windowHandle);
_currentLurker = new ClientLurker(processId);
_currentLurker.AdminRequested += CurrentLurker_AdminRequested;
_currentLurker.LeagueChanged += CurrentLurker_LeagueChanged;

if (existingProcess != null)
{
Start(windowHandle);
Start(processId);
}
else
{
EventHandler<LocationChangedEvent> handler = default;
EventHandler<GeneratingLevelEvent> poe2Handler = default;
handler = (object s, LocationChangedEvent e) =>
{
Start(windowHandle);
Start(processId);
_currentLurker.LocationChanged -= handler;
if (poe2Handler != null)
{
Expand All @@ -711,7 +711,7 @@ private async Task WaitForPoe(bool fromClosing)
// Poe 2
poe2Handler = (object s, GeneratingLevelEvent e) =>
{
Start(windowHandle);
Start(processId);
_currentLurker.GeneratingLevel -= poe2Handler;
if (handler != null)
{
Expand Down

0 comments on commit 11fa41b

Please sign in to comment.