Fix nil pointer dereference crash in bd sync command (#108)

The sync command was crashing at sync.go:245 with a nil pointer
dereference when running in direct mode (without daemon). The
exportToJSONL function attempted to use store.SearchIssues()
without first ensuring the store was initialized.

This fix adds a call to ensureStoreActive() before accessing
the store, matching the pattern used by other commands like
export. This ensures the store is properly initialized whether
running with or without the daemon.

Fixes #106

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Joshua Park
2025-10-22 17:50:05 -05:00
committed by GitHub
parent 67cd529f72
commit a689c66f77

View File

@@ -258,6 +258,11 @@ func exportToJSONL(ctx context.Context, jsonlPath string) error {
}
// Direct mode: access store directly
// Ensure store is initialized
if err := ensureStoreActive(); err != nil {
return fmt.Errorf("failed to initialize store: %w", err)
}
// Get all issues
issues, err := store.SearchIssues(ctx, "", types.IssueFilter{})
if err != nil {