Browse Source

return nil instead of memory access error

pull/2/head
Chris Lu 12 years ago
parent
commit
1aea3512a4
  1. 5
      go/topology/volume_layout.go

5
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 { 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) { func (vl *VolumeLayout) PickForWrite(count int) (*storage.VolumeId, int, *VolumeLocationList, error) {

Loading…
Cancel
Save