fix(scoreboard): clear the two nullable warnings
Both were mine, from the scoreboard units: - ScoreboardLayout.FitLine null-forgave tileWidths on one expression and then iterated the field anyway; it now binds a non-null local once and uses that throughout. - the output resolver dereferenced _scoreboardPresenter, which is assigned in InitScoreboard — it is nullable by construction, so the resolver reads '?.' exactly like the other optional services. Clean build, 0 warnings, scoreboard tests green.
This commit is contained in:
@@ -53,11 +53,12 @@ public static class ScoreboardLayout
|
||||
public static Fit FitLine(IReadOnlyList<double> tileWidths, double separatorWidth,
|
||||
double availableWidth, double requestedSize = MaxFontSize, double floorSize = FloorFontSize)
|
||||
{
|
||||
var count = tileWidths?.Count ?? 0;
|
||||
var widths = tileWidths ?? System.Array.Empty<double>();
|
||||
var count = widths.Count;
|
||||
if (count == 0 || availableWidth <= 0)
|
||||
return new Fit(requestedSize, 1, false);
|
||||
|
||||
var total = tileWidths!.Sum() + separatorWidth * (count - 1);
|
||||
var total = widths.Sum() + separatorWidth * (count - 1);
|
||||
if (total <= availableWidth)
|
||||
return new Fit(requestedSize, 1, false);
|
||||
|
||||
@@ -70,7 +71,7 @@ public static class ScoreboardLayout
|
||||
var factor = floorSize / requestedSize;
|
||||
var lines = 1;
|
||||
var lineWidth = 0.0;
|
||||
foreach (var width in tileWidths)
|
||||
foreach (var width in widths)
|
||||
{
|
||||
var w = width * factor;
|
||||
var needed = lineWidth == 0 ? w : lineWidth + separatorWidth + w;
|
||||
|
||||
Reference in New Issue
Block a user