From 1aea3512a4af8ea5423e3d625dc19386fee51a73 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 20 Mar 2013 01:23:15 -0700 Subject: [PATCH] return nil instead of memory access error --- go/topology/volume_layout.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {