Skip to content

Commit

Permalink
fix: avoid nil pointer dereference (#2061)
Browse files Browse the repository at this point in the history
  • Loading branch information
okaybase authored Aug 23, 2021
1 parent dde8827 commit a3ac120
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/internal/handler/data_loader/route_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ var (
func (h *Handler) ExportAllRoutes(c droplet.Context) (interface{}, error) {
routelist, err := h.routeStore.List(c.Context(), store.ListInput{})

if len(routelist.Rows) < 1 {
return nil, consts.ErrRouteData
}

if err != nil {
return nil, err
}

if len(routelist.Rows) < 1 {
return nil, consts.ErrRouteData
}

routes := []*entity.Route{}

for _, route := range routelist.Rows {
Expand Down Expand Up @@ -412,7 +412,7 @@ func ParseRoutePlugins(route *entity.Route, paramsRefs []*openapi3.ParameterRef,
log.Errorf("Plugins MergeJson err: ", err)
return path, nil, nil, nil, err
}
err = json.Unmarshal([]byte(bytePlugins), &plugins)
err = json.Unmarshal(bytePlugins, &plugins)
if err != nil {
log.Errorf("JsonToMapDemo err: ", err)
return path, nil, nil, nil, err
Expand Down

0 comments on commit a3ac120

Please sign in to comment.