mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-16 20:26:45 +00:00
storage: nil-safe ReplicaPlacement.String()
Guard a nil receiver like TTL.String() already does, so formatting a zero-value VolumeInfo can't depend on fmt's panic recovery.
This commit is contained in:
@@ -69,6 +69,9 @@ func (rp *ReplicaPlacement) Byte() byte {
|
||||
}
|
||||
|
||||
func (rp *ReplicaPlacement) String() string {
|
||||
if rp == nil {
|
||||
return ""
|
||||
}
|
||||
b := make([]byte, 3)
|
||||
b[0] = byte(rp.DiffDataCenterCount + '0')
|
||||
b[1] = byte(rp.DiffRackCount + '0')
|
||||
|
||||
Reference in New Issue
Block a user