Part of #135.
When a XLiffTransUnit with Source = null is passed to XLiffBody.AddTransUnit, the else branch executes TranslationsById[tu.Id] = tu.Source.Value, which throws a NullReferenceException. The NumberTranslated property has the same unguarded access.
Fix: Add a null guard on tu.Source before accessing .Value in both places.
Files affected: src/L10NSharp/XLiffUtils/XLiffBody.cs
Part of #135.
When a
XLiffTransUnitwithSource = nullis passed toXLiffBody.AddTransUnit, the else branch executesTranslationsById[tu.Id] = tu.Source.Value, which throws aNullReferenceException. TheNumberTranslatedproperty has the same unguarded access.Fix: Add a null guard on
tu.Sourcebefore accessing.Valuein both places.Files affected:
src/L10NSharp/XLiffUtils/XLiffBody.cs