forked from ddrilling/AsbCloudServer
Fixed exception with .ElementAt(0) call at empty collection
This commit is contained in:
parent
a7962492af
commit
1debac9505
@ -469,10 +469,14 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static IEnumerable<OperationParams> MakeOperationsExt(IEnumerable<WellOperation> operations)
|
private static IEnumerable<OperationParams> MakeOperationsExt(IEnumerable<WellOperation> operations)
|
||||||
|
{
|
||||||
|
var ops = new List<OperationParams>();
|
||||||
|
|
||||||
|
if (operations.Any())
|
||||||
{
|
{
|
||||||
var sortedOperations = operations.OrderBy(o => o.StartDate);
|
var sortedOperations = operations.OrderBy(o => o.StartDate);
|
||||||
var count = operations.Count();
|
var count = operations.Count();
|
||||||
var ops = new List<OperationParams>(count);
|
ops = new List<OperationParams>(count);
|
||||||
var item = operations.ElementAt(0);
|
var item = operations.ElementAt(0);
|
||||||
var wellDepth = item.WellDepth;
|
var wellDepth = item.WellDepth;
|
||||||
var pre = new OperationParams(item);
|
var pre = new OperationParams(item);
|
||||||
@ -488,6 +492,8 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
pre = current;
|
pre = current;
|
||||||
}
|
}
|
||||||
ops.Add(current);
|
ops.Add(current);
|
||||||
|
}
|
||||||
|
|
||||||
return ops;
|
return ops;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user