Skip to content

Commit

Permalink
Fix nil pointer deref
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvolp12 committed Sep 29, 2023
1 parent 9eca7fb commit 6fe2803
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion repomgr/repomgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,12 +885,19 @@ func (rm *RepoManager) processNewRepo(ctx context.Context, user models.Uid, r io
}

if err := cb(ctx, root, finish, ds); err != nil {
return fmt.Errorf("cb errored root: %s, rev: %s: %w", root, *rev, err)
return fmt.Errorf("cb errored root: %s, rev: %s: %w", root, stringOrNil(rev), err)
}

return nil
}

func stringOrNil(s *string) string {
if s == nil {
return "nil"
}
return *s
}

// walkTree returns all cids linked recursively by the root, skipping any cids
// in the 'skip' map, and not erroring on 'not found' if prevMissing is set
func walkTree(ctx context.Context, skip map[cid.Cid]bool, root cid.Cid, bs blockstore.Blockstore, prevMissing bool) ([]cid.Cid, error) {
Expand Down

0 comments on commit 6fe2803

Please sign in to comment.