Skip to content

XLiffBody.AddTransUnit throws NRE when Source is null #149

@imnasnainaec

Description

@imnasnainaec

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions