Fix panic when swagger has no paths
Fixes
Fix a panic in linkerd profile --open-api when the swagger spec has no Paths field.
@@ -164,10 +164,12 @@ func renderOpenAPI(options *profileOptions, w io.Writer) error {
routes := make([]*sp.RouteSpec, 0)
paths := make([]string, 0)
+ if swagger.Paths != nil {
for path := range swagger.Paths.Paths {
paths = append(paths, path)
}
sort.Strings(paths)
+ }
for _, path := range paths {
item := swagger.Paths.Paths[path]
