Skip to content

Commit

Permalink
Added a nil check for resp.GetError() in the EOS gRPC client. This fi…
Browse files Browse the repository at this point in the history
…xes a nil pointer dereference in the RollbackToVersion method (#4896)

Co-authored-by: Jesse Geens <jgeens@cern.ch>
  • Loading branch information
jessegeens and Jesse Geens authored Oct 21, 2024
1 parent d2b2c10 commit 10664f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/restorefileversion-nilptr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: fix nilpointer error in RollbackToVersion

https://github.com/cs3org/reva/pull/4896
5 changes: 3 additions & 2 deletions pkg/eosclient/eosgrpc/eosgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1544,8 +1544,9 @@ func (c *Client) RollbackToVersion(ctx context.Context, auth eosclient.Authoriza
return errtypes.InternalError(fmt.Sprintf("nil response for uid: '%s' ", auth.Role.UID))
}

log.Info().Str("func", "RollbackToVersion").Int64("errcode", resp.GetError().Code).Str("errmsg", resp.GetError().Msg).Msg("grpc response")

if resp.GetError() != nil {
log.Info().Str("func", "RollbackToVersion").Int64("errcode", resp.GetError().Code).Str("errmsg", resp.GetError().Msg).Msg("grpc response")
}
return err
}

Expand Down

0 comments on commit 10664f4

Please sign in to comment.