pb33f / openapi-changes

The world's sexiest OpenAPI breaking changes detector. Discover what changed between two OpenAPI specs, or a single spec over time. Supports OpenAPI 3.1, 3.0 and Swagger
https://pb33f.io/openapi-changes/
Other
180 stars 16 forks source link

Crash Occurs in Report Command When No Changes Are Detected #82

Closed tomatbay closed 9 months ago

tomatbay commented 9 months ago

The program crashes when the report command is used and no changes are detected. Instead of a crash, it is expected to display a user-friendly message indicating that no changes have been detected.

edobrb commented 9 months ago

html-report works but report throws

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1050a6f6c]

goroutine 1 [running]:
github.com/pb33f/libopenapi/what-changed/reports.CreateOverallReport(0x0)
    C:/Users/runneradmin/go/pkg/mod/github.com/pb33f/libopenapi@v0.14.4/what-changed/reports/summary.go:26 +0x2c
github.com/pb33f/openapi-changes/cmd.createReport(...)
    D:/a/openapi-changes/openapi-changes/cmd/report.go:354
github.com/pb33f/openapi-changes/cmd.runLeftRightReport({0x16b2cb9f7, 0xc}, {0x16b2cba04, 0xc}, 0x4?, 0x105760018?, {0x0, 0x0}, 0x0?)
    D:/a/openapi-changes/openapi-changes/cmd/report.go:350 +0x608
github.com/pb33f/openapi-changes/cmd.GetReportCommand.func1(0x140001fe200?, {0x140001429e0, 0x2, 0x10519d449?})
    D:/a/openapi-changes/openapi-changes/cmd/report.go:194 +0x7dc
github.com/spf13/cobra.(*Command).execute(0x1400029c600, {0x14000142980, 0x2, 0x2})
    C:/Users/runneradmin/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x105db7500)
    C:/Users/runneradmin/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
    C:/Users/runneradmin/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/pb33f/openapi-changes/cmd.Execute({0x10554406c?, 0x19?}, {0x105544740?, 0x1051ab4c2?}, {0x140001a6780?, 0x14000002340?})
    D:/a/openapi-changes/openapi-changes/cmd/root.go:51 +0xc0
main.main()
    D:/a/openapi-changes/openapi-changes/openapi-changes.go:29 +0x184
daveshanley commented 9 months ago

will fix asap.

daveshanley commented 9 months ago

Fixed in v0.0.52 All commands operate as expected with identical specs. No crashes.

Screenshot 2024-01-05 at 9 01 51 AM