diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-03-20 01:23:15 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-03-20 01:23:15 -0700 |
| commit | 1aea3512a4af8ea5423e3d625dc19386fee51a73 (patch) | |
| tree | d33689e2158069848595546156aba5d4afadfeee /go/topology/volume_layout.go | |
| parent | 6658d5de455a2da5e48ad1c4c7dffa18a9fa1dec (diff) | |
| download | seaweedfs-1aea3512a4af8ea5423e3d625dc19386fee51a73.tar.xz seaweedfs-1aea3512a4af8ea5423e3d625dc19386fee51a73.zip | |
return nil instead of memory access error
Diffstat (limited to 'go/topology/volume_layout.go')
| -rw-r--r-- | go/topology/volume_layout.go | 5 |
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) { |
