mirror of https://github.com/waku-org/nwaku.git
fix: fixes out of bounds crash when waku2 is not set (#1895)
This commit is contained in:
parent
c8446aebca
commit
03363f1bd8
|
@ -76,6 +76,9 @@ func waku2*(record: TypedRecord): Option[CapabilitiesBitfield] =
|
||||||
if field.isNone():
|
if field.isNone():
|
||||||
return none(CapabilitiesBitfield)
|
return none(CapabilitiesBitfield)
|
||||||
|
|
||||||
|
if field.get().len != 1:
|
||||||
|
return none(CapabilitiesBitfield)
|
||||||
|
|
||||||
some(CapabilitiesBitfield(field.get()[0]))
|
some(CapabilitiesBitfield(field.get()[0]))
|
||||||
|
|
||||||
proc supportsCapability*(r: Record, cap: Capabilities): bool =
|
proc supportsCapability*(r: Record, cap: Capabilities): bool =
|
||||||
|
|
Loading…
Reference in New Issue