Skip to content

Commit 31f419d

Browse files
author
CSDotNET
committed
some return value became nullable
1 parent eac2028 commit 31f419d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

TetrEnvironment/Environment.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ public int CurrentFrame
5959
/// <param name="gametype">for blitz, others will be ignored</param>
6060
/// <exception cref="NotImplementedException"></exception>
6161
/// <exception cref="Exception"></exception>
62-
public Environment(IReadOnlyList<Event> events, GameType? gametype)
62+
public Environment(IReadOnlyList<Event>? events, GameType? gametype)
6363
{
6464
IsSelfControlMode = false;
6565
_manager = this;
6666
_events = events;
6767
//todo:implement it in Options
6868
Kickset = new KicksetSRSPlus();
6969

70-
var eventEnd = (events.First(@event => @event.type == EventType.End) as EventEnd);
71-
if (eventEnd != null)
70+
if (events != null &&
71+
events.FirstOrDefault(@event => @event.type == EventType.End) is EventEnd eventEnd)
7272
TotalFrame = (int)eventEnd.frame;
7373
else //TODO: EventExit instead of EventEnd?
74-
throw new NotImplementedException();
74+
throw new Exception("no end event detected!");
7575

7676
try
7777
{

0 commit comments

Comments
 (0)