Skip to content

Commit

Permalink
Fix bug caught by coderabbitai
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoch786 committed Dec 5, 2024
1 parent f289503 commit 68c18c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ func (app *App) register(methods []string, pathRaw string, group *Group, handler
if app.routeExists(method, pathRaw) {
//Decrement global handler count
atomic.AddUint32(&app.handlersCount, ^uint32(len(handlers)-1)) //nolint:gosec // Not a concern
// Decrement global route position
atomic.AddUint32(&app.routesCount, ^uint32(0))
app.removeRoute(pathRaw, []string{method})
}
app.mutex.Unlock()
Expand Down Expand Up @@ -425,7 +427,7 @@ func (app *App) removeRoute(path string, methods []string) {
}

// Remove route from tree stack
app.stack[m] = slices.Delete(app.stack[m], 1, 1)
app.stack[m] = slices.Delete(app.stack[m], index, index+1)
}

// TODO THIS
Expand Down

0 comments on commit 68c18c1

Please sign in to comment.