aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-01-08 08:49:18 -0800
committerChris Lu <chris.lu@gmail.com>2020-01-08 08:49:18 -0800
commit943f4986ef27fda2487eff0669ecf79faaaacda1 (patch)
tree00a03ca7bc5f7b3fa3343c2e7be8797d81014bd0
parent9995d3bcb581d3d20e152ff2a359b22b6a8563fd (diff)
downloadseaweedfs-943f4986ef27fda2487eff0669ecf79faaaacda1.tar.xz
seaweedfs-943f4986ef27fda2487eff0669ecf79faaaacda1.zip
fix possible nil
-rw-r--r--weed/storage/needle/volume_ttl.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/storage/needle/volume_ttl.go b/weed/storage/needle/volume_ttl.go
index 4a169870d..179057876 100644
--- a/weed/storage/needle/volume_ttl.go
+++ b/weed/storage/needle/volume_ttl.go
@@ -69,6 +69,9 @@ func (t *TTL) ToBytes(output []byte) {
}
func (t *TTL) ToUint32() (output uint32) {
+ if t == nil || t.Count == 0 {
+ return 0
+ }
output = uint32(t.Count) << 8
output += uint32(t.Unit)
return output