Skip to content

Commit 92eadc4

Browse files
committed
fix: handle nullable decimal values in BufferV3
1 parent d9cd6d1 commit 92eadc4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/net-questdb-client/Buffers/BufferV3.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public override IBuffer Column(ReadOnlySpan<char> name, decimal? value)
9090
var low = parts[0];
9191
var mid = parts[1];
9292
var high = parts[2];
93-
var negative = (flags & SignMask) != 0 && value != 0;
93+
var negative = (flags & SignMask) != 0 && value.Value != 0m;
9494

9595
if (negative)
9696
{
@@ -109,15 +109,15 @@ public override IBuffer Column(ReadOnlySpan<char> name, decimal? value)
109109
BinaryPrimitives.WriteInt32BigEndian(span.Slice(1, 4), high);
110110
BinaryPrimitives.WriteInt32BigEndian(span.Slice(5, 4), mid);
111111
BinaryPrimitives.WriteInt32BigEndian(span.Slice(9, 4), low);
112-
112+
113113
// Compress
114114
var start = 0;
115115
for (;
116116
// We can strip prefix bits that are 0 (if positive) or 1 (if negative) as long as we keep at least
117117
// one of it in front to convey the sign.
118118
start < span.Length - 1 && span[start] == signByte && ((span[start + 1] ^ signByte) & 0x80) == 0;
119119
start++) ;
120-
120+
121121
// 4. Length
122122
var size = span.Length - start;
123123
Put((byte)size);

0 commit comments

Comments
 (0)