Handle corner-case: null reflist.

This commit is contained in:
Andrey Smirnov
2014-02-24 12:17:24 +04:00
parent 97becf199f
commit 1b64612aef
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -51,6 +51,11 @@ func NewPackageList() *PackageList {
// NewPackageListFromRefList loads packages list from PackageRefList
func NewPackageListFromRefList(reflist *PackageRefList, collection *PackageCollection) (*PackageList, error) {
// empty reflist
if reflist == nil {
return NewPackageList(), nil
}
result := &PackageList{packages: make(map[string]*Package, reflist.Len())}
err := reflist.ForEach(func(key []byte) error {