aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-03-20 01:23:15 -0700
committerChris Lu <chris.lu@gmail.com>2013-03-20 01:23:15 -0700
commit1aea3512a4af8ea5423e3d625dc19386fee51a73 (patch)
treed33689e2158069848595546156aba5d4afadfeee
parent6658d5de455a2da5e48ad1c4c7dffa18a9fa1dec (diff)
downloadseaweedfs-1aea3512a4af8ea5423e3d625dc19386fee51a73.tar.xz
seaweedfs-1aea3512a4af8ea5423e3d625dc19386fee51a73.zip
return nil instead of memory access error
-rw-r--r--go/topology/volume_layout.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/go/topology/volume_layout.go b/go/topology/volume_layout.go
index f5c2e2360..0791bed20 100644
--- a/go/topology/volume_layout.go
+++ b/go/topology/volume_layout.go
@@ -43,7 +43,10 @@ func (vl *VolumeLayout) isWritable(v *storage.VolumeInfo) bool {
}
func (vl *VolumeLayout) Lookup(vid storage.VolumeId) []*DataNode {
- return vl.vid2location[vid].list
+ if location := vl.vid2location[vid]; location != nil {
+ return location.list
+ }
+ return nil
}
func (vl *VolumeLayout) PickForWrite(count int) (*storage.VolumeId, int, *VolumeLocationList, error) {