Commit ee5b800
committed
Fix: Added empty refs collection check in Cell constructor
Before: When calculating the maximum level using refs.Max(x => x.Level), an exception "Sequence contains no elements" occurred if the collection was empty.
After: Added a check for non-empty collection using refs.Count > 0 (instead of refs.Any()) and defaulted the level to (byte)0 if the collection is empty. This aligns with CA1860 recommendations and improves performance.1 parent 84072f1 commit ee5b800
1 file changed
+7
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
0 commit comments