Skip to content

Commit fc495da

Browse files
commands: fix panic when calling NewSketch with empty directories.user
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
1 parent 695c85e commit fc495da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: commands/service_sketch_new.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (s *arduinoCoreServerImpl) NewSketch(ctx context.Context, req *rpc.NewSketc
4848
if len(req.GetSketchDir()) > 0 {
4949
sketchesDir = req.GetSketchDir()
5050
} else {
51-
sketchesDir = s.settings.GetString("directories.User")
51+
sketchesDir = s.settings.UserDir().String()
5252
}
5353

5454
if err := validateSketchName(req.GetSketchName()); err != nil {

0 commit comments

Comments
 (0)