Fix edge case

This commit is contained in:
Ali 2021-10-27 20:41:50 +04:00
parent a5028f88ce
commit 78b29729c4

View File

@ -166,7 +166,7 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
let offsetIdHighBits = (data >> (32 + 3)) & 0xffffffff
let idHighBits = offsetIdHighBits << 32
if idHighBits == 0 {
if idHighBits == 0 && namespaceBits != 0 {
if let uint32Value = UInt32(exactly: idLowBits) {
self.id = Id(rawValue: Int64(Int32(bitPattern: uint32Value)))
} else {