From 943f4986ef27fda2487eff0669ecf79faaaacda1 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 8 Jan 2020 08:49:18 -0800 Subject: [PATCH] fix possible nil --- weed/storage/needle/volume_ttl.go | 3 +++ 1 file changed, 3 insertions(+) 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