Skip to content

Commit

Permalink
Merge pull request #63 from chaitin/fix(walk)/panic
Browse files Browse the repository at this point in the history
fix(walk): avoid panic
  • Loading branch information
zhoubinxuan authored Apr 28, 2023
2 parents 01190f0 + 4982d2a commit 74384b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions go/pkg/binding/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,13 @@ func handleError(code ErrorType) error {
}
return handleErrorInternal(err)
}

// handleWalkError is used for walk function
// error handler.
func handleWalkError(code ErrorType) error {
err := Handle(IDType(code))
if err.IsEOK() {
return nil
}
return handleErrorInternal(err)
}
2 changes: 1 addition & 1 deletion go/pkg/binding/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (h Handle) Walk(path string, f WalkFunc) error {
continue
}
defer walkFuncMap.Delete(cookie)
if err := handleError(C.veinmind_InvokeWalkHandler(
if err := handleWalkError(C.veinmind_InvokeWalkHandler(
h.ID(), str.ID(), unsafe.Pointer(cookie))); err != nil {
return err
}
Expand Down

0 comments on commit 74384b9

Please sign in to comment.