From d8521df77acb4cff1cedb49e71c5e798da8fd33f Mon Sep 17 00:00:00 2001 From: okaybase Date: Wed, 11 Aug 2021 16:58:45 +0800 Subject: [PATCH] avoid nil pointer dereference --- api/internal/handler/data_loader/route_export.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/internal/handler/data_loader/route_export.go b/api/internal/handler/data_loader/route_export.go index aa8218cef3..e589410bef 100644 --- a/api/internal/handler/data_loader/route_export.go +++ b/api/internal/handler/data_loader/route_export.go @@ -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 {