Skip to content

Commit

Permalink
fix: invaild id error
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Nov 19, 2024
1 parent b788755 commit 0562c7a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func (ctx *Context) handleOverride(override ...any) string {

func (ctx *Context) runPipeline(entry, override string) *TaskDetail {
taskId := maa.MaaContextRunPipeline(ctx.handle, entry, override)
if taskId == 0 {
return nil
}
tasker := ctx.GetTasker()
return tasker.getTaskDetail(taskId)
}
Expand Down Expand Up @@ -58,6 +61,9 @@ func (ctx *Context) runRecognition(entry, override string, img image.Image) *Rec
defer imgBuf.Destroy()

recId := maa.MaaContextRunRecognition(ctx.handle, entry, override, uintptr(imgBuf.Handle()))
if recId == 0 {
return nil
}
tasker := ctx.GetTasker()
return tasker.getRecognitionDetail(recId)
}
Expand Down Expand Up @@ -89,6 +95,9 @@ func (ctx *Context) runAction(entry, override string, box Rect, recognitionDetai
defer rectBuf.Destroy()

nodeId := maa.MaaContextRunAction(ctx.handle, entry, override, uintptr(rectBuf.Handle()), recognitionDetail)
if nodeId == 0 {
return nil
}
tasker := ctx.GetTasker()
return tasker.getNodeDetail(nodeId)
}
Expand Down

0 comments on commit 0562c7a

Please sign in to comment.