Skip to content

Commit

Permalink
Merge pull request #4856 from 2403905/pr4855
Browse files Browse the repository at this point in the history
fix the nil pointer
  • Loading branch information
2403905 authored Sep 19, 2024
2 parents 4849435 + 4f3854a commit 5562631
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 5562631

Please sign in to comment.