Skip to content

Commit 4d64bcf

Browse files
committed
Session.GetLastTrial uses Block.lastTrial
1 parent 06b9d26 commit 4d64bcf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Assets/UXF/Scripts/Session.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,15 +486,17 @@ Trial GetFirstTrial()
486486
Trial GetLastTrial()
487487
{
488488
if (blocks.Count == 0) throw new NoSuchTrialException("There is no last trial because no blocks have been created!");
489-
489+
490490
Block lastValidBlock;
491+
Trial lastTrial;
491492
int i = blocks.Count - 1;
492493
while (i >= 0)
493494
{
494495
lastValidBlock = blocks[i];
495-
if (lastValidBlock.trials.Count > 0)
496+
lastTrial = lastValidBlock.lastTrial;
497+
if (lastTrial != null)
496498
{
497-
return lastValidBlock.trials[lastValidBlock.trials.Count - 1];
499+
return lastTrial;
498500
}
499501
i--;
500502
}

0 commit comments

Comments
 (0)