Browse Source

Fix empty imp panic in response

main
Дмитрий 2 years ago
parent
commit
e6a44f2a54
  1. 4
      cmd/client_server/handlers.go

4
cmd/client_server/handlers.go

@ -106,6 +106,10 @@ func handleRequest(partners []customtypes.PartnersAddress) http.HandlerFunc {
// for each tile peak best price // for each tile peak best price
for _, tile := range incReq.Tiles { for _, tile := range incReq.Tiles {
if len(prices[tile.Id]) == 0 {
log.Println("No imp for tile ", tile.Id)
continue
}
last := len(prices[tile.Id]) - 1 last := len(prices[tile.Id]) - 1
biggestPrice := prices[tile.Id][last] biggestPrice := prices[tile.Id][last]
bestOptions = append(bestOptions, partnersRespones[tile.Id][biggestPrice]) bestOptions = append(bestOptions, partnersRespones[tile.Id][biggestPrice])

Loading…
Cancel
Save