Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Forum Thread 17591 Fix #494

Open
eosrios opened this issue Dec 16, 2022 · 0 comments
Open

Dev Forum Thread 17591 Fix #494

eosrios opened this issue Dec 16, 2022 · 0 comments
Assignees

Comments

@eosrios
Copy link

eosrios commented Dec 16, 2022

Running headless Client initialization will crash if expected environment variables don't exist because there is no null checking and subsequent Path.Combine requires non-null parameters.

\resources\sdk\pureclouddotnet\templates\Configuration.mustache

Simple fix to add NULL coalescing to the assignment;

Before

                string homePath = (Environment.OSVersion.Platform == PlatformID.Unix ||
                                Environment.OSVersion.Platform == PlatformID.MacOSX)
                    ? Environment.GetEnvironmentVariable("HOME")
                    : Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");

After

                string homePath = (Environment.OSVersion.Platform == PlatformID.Unix ||
                                Environment.OSVersion.Platform == PlatformID.MacOSX)
                    ? Environment.GetEnvironmentVariable("HOME")
                    : Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%") ?? "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants