Skip to content

Commit 323e333

Browse files
committed
prohibitively added similar nil checks as in gdtf parser to xml parsing
1 parent 79d981a commit 323e333

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

internal/types/mvrxml/general.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ type ConvertToDestinationMapStruct[T any] interface {
158158

159159
func ParseList[Source ConvertToDestinationStruct[Destination], Destination any](config ParseConfigData, source *[]Source) []Destination {
160160
if source == nil {
161-
return nil
161+
return []Destination{}
162162
}
163163
var destination []Destination = make([]Destination, len(*source))
164164
for index, element := range *source {
@@ -169,6 +169,9 @@ func ParseList[Source ConvertToDestinationStruct[Destination], Destination any](
169169
}
170170

171171
func ParseMap[Source ConvertToDestinationMapStruct[Destination], Destination any](config ParseConfigData, source *[]Source) map[string]*Destination {
172+
if source == nil {
173+
return map[string]*Destination{}
174+
}
172175
destination := make(map[string]*Destination)
173176
for _, element := range *source {
174177
parsedElement := element.Parse(config)

0 commit comments

Comments
 (0)