[MISC 4/4] distinguish nil and empty map

Since the function len(X) will return 0 no matter X is nil or
an empty map.

We should distinguish that.

Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
HuKeping
2016-03-11 16:20:02 +08:00
parent 9501cddc1d
commit 2136ca54ba

View File

@@ -453,7 +453,7 @@ func (c *Client) downloadSigned(role string, size int64, expectedHashes data.Has
return nil, nil, err
}
if len(expectedHashes) != 0 {
if expectedHashes != nil {
if err := data.CheckHashes(raw, expectedHashes); err != nil {
return nil, nil, ErrChecksumMismatch{role: role}
}