Skip to content

Commit

Permalink
Merge pull request #9 from Jump-King-Multiplayer/fix/userinfo-crash
Browse files Browse the repository at this point in the history
Fixed crash that occured when attempting to connect to a non friend player
  • Loading branch information
Skippeh authored Jan 15, 2022
2 parents 751d1e0 + 0be9eb6 commit a23a16c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion JKMP.Plugin.Multiplayer/JKMP.Plugin.Multiplayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JKMP.Facepunch.Steamworks.Win32" Version="2.3.4" />
<PackageReference Include="JKMP.Facepunch.Steamworks.Win32" Version="2.3.5" />
<PackageReference Include="JKMP.Core" Version="0.8.3" />
<PackageReference Include="JKMP.GameDependencies" Version="1.0.0" />
<PackageReference Include="JKMP.Myra" Version="2.0.1" />
Expand Down
2 changes: 1 addition & 1 deletion JKMP.Plugin.Multiplayer/Steam/SteamManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static bool InitializeSteam()
{
try
{
SteamClient.Init(1061090, false);
SteamClient.Init(1061090, true);
}
catch (Exception ex)
{
Expand Down
11 changes: 2 additions & 9 deletions JKMP.Plugin.Multiplayer/Steam/SteamUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JKMP.Core.Logging;
using Steamworks;

namespace JKMP.Plugin.Multiplayer.Steam
Expand Down Expand Up @@ -29,15 +30,7 @@ private static void OnPersonaStateChange(Friend friend)
{
if (!SteamFriends.RequestUserInformation(steamId))
{
Friend friend = SteamFriends.GetFriends().FirstOrDefault(f => f.Id == steamId);

if (!friend.Id.IsValid)
friend = SteamFriends.GetFriendsOnGameServer().FirstOrDefault(f => f.Id == steamId);

if (!friend.Id.IsValid)
return null;

return friend;
return new Friend(steamId);
}

var tcs = new TaskCompletionSource<Friend>();
Expand Down

0 comments on commit a23a16c

Please sign in to comment.