Changeset 16496


Ignore:
Timestamp:
01/04/19 11:41:42 (2 months ago)
Author:
bburlacu
Message:

#2976: Add null check to avoid NullReferenceException.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Random/3.3/RandomEnumerable.cs

    r15583 r16496  
    202202        var cur = list.First;
    203203        double ball = cur.Value.Item2, sum = random.NextDouble() * total; // assert: sum < total. When there is only one item remaining: sum < ball
    204         while (ball < sum) {
     204        while (ball < sum && cur.Next != null) {
    205205          cur = cur.Next;
    206206          ball += cur.Value.Item2;
Note: See TracChangeset for help on using the changeset viewer.