Skip to content

Commit dca4b3a

Browse files
committed
fix: SubCollectionsがnilの時もあるので、先にnil比較を行うようにした
1 parent 78d59cd commit dca4b3a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/inserter/js_inserter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (j *JSInserter) CreateItem(ctx context.Context, cn string, items []JsonMode
7676
}
7777
return xerrors.Errorf("failed to create item in array (index=%s): %w", strings.Join(errorIndexes, "/"), err)
7878
}
79-
if len(parentItem.SubCollections) == 0 {
79+
if parentItem.SubCollections == nil || len(parentItem.SubCollections) == 0 {
8080
continue
8181
}
8282
for collectionName, subItems := range parentItem.SubCollections {

pkg/inserter/json_inserter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (j *JSONInserter) CreateItem(ctx context.Context, cn string, items []JsonMo
5252
}
5353
return xerrors.Errorf("failed to create item in array (index=%s): %w", strings.Join(errorIndexes, "/"), err)
5454
}
55-
if len(parentItem.SubCollections) == 0 {
55+
if parentItem.SubCollections == nil || len(parentItem.SubCollections) == 0 {
5656
continue
5757
}
5858
for collectionName, subItems := range parentItem.SubCollections {

0 commit comments

Comments
 (0)