diff options
| author | chrislu <chris.lu@gmail.com> | 2022-04-05 10:49:17 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-04-05 10:49:17 -0700 |
| commit | bb4beebce368f9c19257cf67779b5f65e99c6e21 (patch) | |
| tree | 023106646340a9d1a74b8a889342a51dfd68a68a /weed/filer/filechunks.go | |
| parent | ae5aa2bf042c3eb920172b1db16de5c95f77e65e (diff) | |
| download | seaweedfs-bb4beebce368f9c19257cf67779b5f65e99c6e21.tar.xz seaweedfs-bb4beebce368f9c19257cf67779b5f65e99c6e21.zip | |
prevent nil
Diffstat (limited to 'weed/filer/filechunks.go')
| -rw-r--r-- | weed/filer/filechunks.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go index fd9694b38..11a779147 100644 --- a/weed/filer/filechunks.go +++ b/weed/filer/filechunks.go @@ -23,6 +23,9 @@ func TotalSize(chunks []*filer_pb.FileChunk) (size uint64) { } func FileSize(entry *filer_pb.Entry) (size uint64) { + if entry == nil || entry.Attributes == nil { + return 0 + } fileSize := entry.Attributes.FileSize if entry.RemoteEntry != nil { if entry.RemoteEntry.RemoteMtime > entry.Attributes.Mtime { |
