diff --git a/changelog/unreleased/fix-time-convertion.md b/changelog/unreleased/fix-time-convertion.md new file mode 100644 index 0000000000..1c9b6e0806 --- /dev/null +++ b/changelog/unreleased/fix-time-convertion.md @@ -0,0 +1,5 @@ +Bugfix: Fix time conversion + +We fixed a nil pointer in a time conversion + +https://github.com/cs3org/reva/pull/4856 diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 8f97f7be81..77e1c9ef0e 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -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)) }