Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2220,8 +2220,9 @@ bool CSteamNetworkingUtils::SetConfigValue( ESteamNetworkingConfigValue eValue,
case k_ESteamNetworkingConfig_ConnectionUserData:
{

// We only need special handling when modifying a connection
if ( eScopeType != k_ESteamNetworkingConfig_Connection )
// We only need special handling when modifying a connection.
// Clearing it (NULL) falls through and is rejected by SetConfigValueTyped.
if ( eScopeType != k_ESteamNetworkingConfig_Connection || pValue == nullptr )
break;

// Process the user argument, maybe performing type conversion
Expand Down
3 changes: 3 additions & 0 deletions tests/test_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,9 @@ void Test_pipe()
assert( infoBob.m_identityRemote == identAlice );
}

// Connection user data cannot be cleared. Passing NULL should fail, not crash.
assert( !SteamNetworkingUtils()->SetConfigValue( k_ESteamNetworkingConfig_ConnectionUserData, k_ESteamNetworkingConfig_Connection, hAlice, k_ESteamNetworkingConfig_Int64, nullptr ) );

// Wire up to the global peer state used by TestNetworkConditions / PumpCallbacksAndMakeSureStillConnected.
g_peerClient.Reset();
g_peerServer.Reset();
Expand Down