Skip to content

Commit 366909a

Browse files
authored
Merge pull request #12 from atonce-original/master
Fix Cell.cs
2 parents d68f608 + ee5b800 commit 366909a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

TonLibDotNet/Cells/Cell.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ public class Cell
99
public const int MaxBitsCount = 1023;
1010
public const int MaxRefs = 4;
1111

12-
public Cell(ReadOnlySpan<byte> content, bool isAugmented, ICollection<Cell>? refs = null)
13-
: this(false, refs?.Max(x => x.Level) ?? 0, content, isAugmented, refs)
14-
{
15-
// Nothing.
16-
}
12+
public Cell(ReadOnlySpan<byte> content, bool isAugmented, ICollection<Cell>? refs = null)
13+
: this(false, refs != null && refs.Count > 0 ? refs.Max(x => x.Level) : (byte)0, content, isAugmented, refs)
14+
{
15+
// Nothing.
16+
}
17+
1718

18-
public Cell(bool isExotic, byte level, ReadOnlySpan<byte> content, bool isAugmented, ICollection<Cell>? refs = null)
19+
public Cell(bool isExotic, byte level, ReadOnlySpan<byte> content, bool isAugmented, ICollection<Cell>? refs = null)
1920
{
2021
if (content.Length > MaxContentLength)
2122
{
@@ -150,4 +151,4 @@ public byte[] Hash()
150151
return hashValue;
151152
}
152153
}
153-
}
154+
}

0 commit comments

Comments
 (0)