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

Check for nullptr when getting appdata_path #884

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dmedora
Copy link

@dmedora dmedora commented Apr 23, 2024

At present, there is no check to ensure std::getenv has returned a non-null value in detail::getenv

return std::getenv(env_var);
.

If it is unable to find the APPDATA or HOME env var, it returns a nullptr. appdata_path then tries to use this nullptr to build a string. Updated appdata_path to log an error if a nullptr is returned.

(Context: ran into an issue with this while using LightGBM where the program was unexpectedly crashing without any error due to $HOME not being set.)

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

Successfully merging this pull request may close these issues.

2 participants