Skip to content

Fix NewSketch crash when directories.user is not set#2862

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

Merged

Conversation

alessio-perugini
Copy link
Contributor

@alessio-peruginialessio-perugini commented Mar 12, 2025

Please check if the PR fulfills these requirements

See how to contribute

  • 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.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated 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.

Does this PR introduce a breaking change, and is titled accordingly?

Other information

We were calling directly a function that lookup for user definied settings. In case an user did not set explictly the directory it would return an empty string causing a panic. Instead we should have used a dedicated function `UserDir` that uses a fallback the default directories.user
@alessio-peruginialessio-perugini linked an issue Mar 12, 2025 that may be closed by this pull request
3 tasks
@alessio-peruginialessio-perugini self-assigned this Mar 12, 2025
@alessio-peruginialessio-perugini added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 12, 2025
@codecovCodecov
Copy link

codecovbot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.87%. Comparing base (b9edb78) to head (fc495da).
Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #2862 +/- ## ========================================== - Coverage 67.90% 67.87% -0.03%  ========================================== Files 238 238 Lines 22412 22412 ========================================== - Hits 15218 15212 -6 - Misses 6001 6005 +4 - Partials 1193 1195 +2 
FlagCoverage Δ
unit67.87% <100.00%> (-0.03%)⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@alessio-peruginialessio-perugini merged commit 7271e0a into masterMar 12, 2025
196 checks passed
@alessio-peruginialessio-perugini deleted the 2861-grpc-server-crashes-on-new-sketch-request branch March 12, 2025 16:58
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project
2 participants
@alessio-perugini@cmaglie
close