mirror of https://github.com/perkeep/perkeep.git
search: fix panic when claim and permanode have no attributes.
fixes #881 Change-Id: Ifdea54a56bf879ca418763617acf7bd2b9159dad
This commit is contained in:
parent
3b815de5a6
commit
bbecbc47cd
|
@ -149,5 +149,10 @@ func (pa permAttr) get(attr string) string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
return claimsIntfAttrValue(pa.claims, attr, pa.at, pa.signerFilter)
|
||||
|
||||
if pa.claims != nil {
|
||||
return claimsIntfAttrValue(pa.claims, attr, pa.at, pa.signerFilter)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -77,7 +77,13 @@ type claimPtrSlice []*camtypes.Claim
|
|||
func (s claimPtrSlice) Len() int { return len(s) }
|
||||
func (s claimPtrSlice) Claim(i int) *camtypes.Claim { return s[i] }
|
||||
|
||||
// claimsIntfAttrValue finds the value of an attribute in a list of claims
|
||||
// or empty string if not found. claims must be non-nil.
|
||||
func claimsIntfAttrValue(claims claimsIntf, attr string, at time.Time, signerFilter blob.Ref) string {
|
||||
if claims == nil {
|
||||
panic("nil claims argument in claimsIntfAttrValue")
|
||||
}
|
||||
|
||||
if at.IsZero() {
|
||||
at = time.Now()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue