Skip to content

Commit ba9d7bb

Browse files
committed
Fix #6
1 parent 4177482 commit ba9d7bb

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Assets/UXF/Scripts/Session.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,14 @@ Trial GetPrevTrial()
620620
Trial GetFirstTrial()
621621
{
622622
var firstBlock = blocks[0];
623-
return firstBlock.trials[0];
623+
try
624+
{
625+
return firstBlock.trials[0];
626+
}
627+
catch (ArgumentOutOfRangeException)
628+
{
629+
throw new NoSuchTrialException("There is no first trial. No trials exist in the first block.");
630+
}
624631
}
625632

626633
/// <summary>
@@ -630,7 +637,14 @@ Trial GetFirstTrial()
630637
Trial GetLastTrial()
631638
{
632639
var lastBlock = blocks[blocks.Count - 1];
633-
return lastBlock.trials[lastBlock.trials.Count - 1];
640+
try
641+
{
642+
return lastBlock.trials[lastBlock.trials.Count - 1];
643+
}
644+
catch (ArgumentOutOfRangeException)
645+
{
646+
throw new NoSuchTrialException("There is no last trial. No trials exist in the last block.");
647+
}
634648
}
635649

636650
/// <summary>

0 commit comments

Comments
 (0)