Skip to content

Commit

Permalink
fix the nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Sep 19, 2024
1 parent fb39458 commit 4f3854a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-time-convertion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix time conversion

We fixed a nil pointer in a time conversion

https://github.com/cs3org/reva/pull/4856
3 changes: 3 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ func TSToUnixNano(ts *types.Timestamp) uint64 {

// TSToTime converts a protobuf Timestamp to Go's time.Time.
func TSToTime(ts *types.Timestamp) time.Time {
if ts == nil {
return time.Time{}
}
return time.Unix(int64(ts.Seconds), int64(ts.Nanos))
}

Expand Down

0 comments on commit 4f3854a

Please sign in to comment.