Skip to content

Commit f86bf7b

Browse files
authored
Merge pull request #91 from shiftstack/statusoptional-crash
statusoptional: Embed nil check in checkStatusStruct
2 parents 12ffe25 + 3bec636 commit f86bf7b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pkg/analysis/statusoptional/analyzer.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,14 @@ func (a *analyzer) run(pass *analysis.Pass) (any, error) {
8585
}
8686

8787
statusStructType := getStructFromField(pass, field)
88-
if statusStructType == nil {
89-
return
90-
}
91-
9288
a.checkStatusStruct(pass, statusStructType, markersAccess, jsonTags)
9389
})
9490

9591
return nil, nil //nolint:nilnil
9692
}
9793

9894
func (a *analyzer) checkStatusStruct(pass *analysis.Pass, statusType *ast.StructType, markersAccess markershelper.Markers, jsonTags extractjsontags.StructFieldTags) {
99-
if statusType.Fields == nil || statusType.Fields.List == nil {
95+
if statusType == nil || statusType.Fields == nil || statusType.Fields.List == nil {
10096
return
10197
}
10298

0 commit comments

Comments
 (0)