Skip to content

Commit a3dec5e

Browse files
committed
Fix peeked value unboxing
1 parent 3563c6e commit a3dec5e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ValveKeyValue/ValveKeyValue/Deserialization/KVTokenReader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public KVTokenReader(TextReader textReader)
1111

1212
protected TextReader textReader;
1313
protected bool disposed;
14-
protected int? peekedNext;
14+
int peekedNext = -1;
1515

1616
int lineOffset;
1717
int columnOffset;
@@ -40,10 +40,10 @@ protected bool TryGetNext(out char next)
4040
{
4141
int nextValue;
4242

43-
if (peekedNext.HasValue)
43+
if (peekedNext != -1)
4444
{
45-
nextValue = peekedNext.Value;
46-
peekedNext = null;
45+
nextValue = peekedNext;
46+
peekedNext = -1;
4747
}
4848
else
4949
{
@@ -72,9 +72,9 @@ protected bool TryGetNext(out char next)
7272

7373
protected int Peek()
7474
{
75-
if (peekedNext.HasValue)
75+
if (peekedNext != -1)
7676
{
77-
return peekedNext.Value;
77+
return peekedNext;
7878
}
7979

8080
var next = textReader.Read();

0 commit comments

Comments
 (0)