Fix NewSketch crash when directories.user is not set by alessio-perugini · Pull Request #2862 · arduino/arduino-cli (original) (raw)
Please check if the PR fulfills these requirements
- The PR has no duplicates (please search among the Pull Requests
before creating one) - The PR follows
our contributing guidelines - Tests for the changes have been added (for bug fixes / features)
- Docs have been added / updated (for bug fixes / features)
UPGRADING.mdhas been updated with a migration guide (for breaking changes)configuration.schema.jsonupdated if new parameters are added.
What kind of change does this PR introduce?
Fix a nil pointer
What is the current behavior?
When the directories.user is not set by the user, an empty string is returned instead of using the default value. This leads to a panic
What is the new behavior?
Use the UserDir function that correctly fallback to default dir in case of empty string.