mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix possible nil
This commit is contained in:
parent
9995d3bcb5
commit
943f4986ef
|
@ -69,6 +69,9 @@ func (t *TTL) ToBytes(output []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TTL) ToUint32() (output uint32) {
|
func (t *TTL) ToUint32() (output uint32) {
|
||||||
|
if t == nil || t.Count == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
output = uint32(t.Count) << 8
|
output = uint32(t.Count) << 8
|
||||||
output += uint32(t.Unit)
|
output += uint32(t.Unit)
|
||||||
return output
|
return output
|
||||||
|
|
Loading…
Reference in a new issue