fix(dep): prevent nil pointer panic in --json mode (GH#998)

warnIfCyclesExist was called with nil storage when using daemon mode.
Add nil check to skip cycle warning in daemon mode (daemon handles it).

Fixes #998

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mayor
2026-01-10 12:08:20 -08:00
committed by Steve Yegge
parent d21ee58559
commit 77b9d4762f
2 changed files with 1242 additions and 258 deletions

File diff suppressed because one or more lines are too long

View File

@@ -45,6 +45,9 @@ func isChildOf(childID, parentID string) bool {
// warnIfCyclesExist checks for dependency cycles and prints a warning if found.
func warnIfCyclesExist(s storage.Storage) {
if s == nil {
return // Skip cycle check in daemon mode (daemon handles it)
}
cycles, err := s.DetectCycles(rootCtx)
if err != nil {
fmt.Fprintf(os.Stderr, "Warning: Failed to check for cycles: %v\n", err)