File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,15 @@ public partial class AbstractHypervisor<TSelf>
19
19
20
20
protected void ClearStack ( ) => _stack . Clear ( ) ;
21
21
22
- public Value Peek ( ) => _stack . Peek ( ) ;
23
- public Value Peek ( int offset ) => _stack . Peek ( offset ) ;
22
+ public Value Peek ( )
23
+ => _stack . Count is 0
24
+ ? Value . Null
25
+ : _stack . Peek ( ) ;
26
+
27
+ public Value Peek ( int offset )
28
+ => _stack . Count <= offset
29
+ ? Value . Null
30
+ : _stack . Peek ( offset ) ;
24
31
25
32
public bool PopBoolean ( string error )
26
33
{
Original file line number Diff line number Diff line change @@ -37,4 +37,6 @@ public T Pop()
37
37
public T Peek ( ) => _buffer [ _buffer . CurrentSize - 1 ] ;
38
38
39
39
public T Peek ( int offset ) => _buffer [ _buffer . CurrentSize - 1 - offset ] ;
40
+
41
+ public int Count => _buffer . CurrentSize ;
40
42
}
You can’t perform that action at this time.
0 commit comments