Skip to content

Commit 73daa89

Browse files
author
Scion Agent (harness-journey-inv)
committed
fix: nil-check reimport result and return projectPath resolution errors
- Add nil check for result after Reimport() call to prevent panic on (nil, nil) return - Return error when user-provided projectPath fails to resolve instead of silently ignoring it
1 parent d7b46e2 commit 73daa89

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/harness_config_update.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ func runHarnessConfigUpdate(cmd *cobra.Command, args []string) error {
5555
var gp string
5656
if projectPath != "" {
5757
resolved, err := config.GetResolvedProjectDir(projectPath)
58-
if err == nil {
59-
gp = resolved
58+
if err != nil {
59+
return fmt.Errorf("failed to resolve project path %q: %w", projectPath, err)
6060
}
61+
gp = resolved
6162
} else if projectDir, err := config.GetResolvedProjectDir(""); err == nil {
6263
gp = projectDir
6364
}
@@ -122,6 +123,9 @@ func updateSingleHarnessConfig(ctx context.Context, hubCtx *HubContext, name, ur
122123
if err != nil {
123124
return fmt.Errorf("reimport failed: %w", err)
124125
}
126+
if result == nil {
127+
return fmt.Errorf("reimport returned no result for %q", name)
128+
}
125129

126130
if isJSONOutput() {
127131
return outputJSON(ActionResult{

0 commit comments

Comments
 (0)