Skip to content

Commit a466c6d

Browse files
authored
Fix linter (#16058)
Fix linter, otherwise #16049 fails the linter.
1 parent 4da6c42 commit a466c6d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

changelog/potuz_fix_linter.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Fixed
2+
3+
- Fix array out of bounds in static analyzer.

tools/analyzers/recursivelock/analyzer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ func hasNestedlock(fullRLockSelector *selIdentList, goPos token.Pos, compareMap
525525
if node == (*ast.FuncDecl)(nil) {
526526
return ""
527527
} else if castedNode, ok := node.(*ast.FuncDecl); ok && castedNode.Recv != nil {
528+
if len(castedNode.Recv.List) == 0 || len(castedNode.Recv.List[0].Names) == 0 {
529+
return ""
530+
}
528531
recv = castedNode.Recv.List[0].Names[0]
529532
rLockSelector.changeRoot(recv, pass.TypesInfo.ObjectOf(recv))
530533
}

0 commit comments

Comments
 (0)