Skip to content

Commit f2aeef9

Browse files
fix
Fixing an issue where trying to parse for a bool I did not verify the alternative of no environment variable being set and the string value being "unset" as opposed to "false". This fixes that issue and if it is not a valid bool string the it logs a warning and disables CMB service testing.
1 parent 8c05e03 commit f2aeef9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,16 @@ private bool UseCMBServiceEnviromentVariableSet()
237237
{
238238
if (!m_UseCmbServiceEnv && m_UseCmbServiceEnvString == null)
239239
{
240-
var useCmbService = Environment.GetEnvironmentVariable("USE_CMB_SERVICE") ?? "unset";
241-
m_UseCmbServiceEnv = bool.Parse(useCmbService.ToLower());
240+
var useCmbService = Environment.GetEnvironmentVariable("USE_CMB_SERVICE") ?? "false";
241+
if (bool.TryParse(useCmbService.ToLower(), out bool isTrue))
242+
{
243+
m_UseCmbService = isTrue;
244+
}
245+
else
246+
{
247+
Debug.LogWarning($"USE_CMB_SERVICE value ({useCmbService}) is not a valid bool value. {m_UseCmbService} is being set to false.");
248+
m_UseCmbServiceEnv = false;
249+
}
242250
}
243251
return m_UseCmbServiceEnv;
244252
}

0 commit comments

Comments
 (0)