Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid memory address or nil pointer dereference #1067

Closed
dreamsxin opened this issue Dec 1, 2021 · 4 comments
Closed

invalid memory address or nil pointer dereference #1067

dreamsxin opened this issue Dec 1, 2021 · 4 comments
Labels

Comments

@dreamsxin
Copy link

dreamsxin commented Dec 1, 2021

Describe the bug

 @Response     default    {object}    Response
2021/12/01 14:42:53 Generate swagger docs....
2021/12/01 14:42:53 Generate general API Info, search dir:./
2021/12/01 14:42:53 Generating client.Request
2021/12/01 14:42:53 Generating client.AppInfo
2021/12/01 14:42:53 Generating client.ImpInfo
2021/12/01 14:42:53 Generating client.DeviceInfo
2021/12/01 14:42:53 Generating client.NetworkInfo
2021/12/01 14:42:53 Generating client.GeoInfo
2021/12/01 14:42:53 Generating client.Response
2021/12/01 14:42:53 Generating client.Ad
2021/12/01 14:42:53 Generating client.AdInfo
2021/12/01 14:42:53 Generating client.AdBaseInfo
2021/12/01 14:42:53 Generating client.ConvUrl
2021/12/01 14:42:53 Generating client.AdConversionInfo
2021/12/01 14:42:53 Generating client.AdMaterialInfo
2021/12/01 14:42:53 Generating client.MaterialFeature
2021/12/01 14:42:53 Generating client.MaterialSize
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x4d47a2]

goroutine 1 [running]:
github.com/swaggo/swag.(*Operation).DefaultResponse(...)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/operation.go:987
github.com/swaggo/swag.(*Operation).ParseResponseComment(0xc0002bc120, {0xc0002cc411, 0x26}, 0x5d7d73)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/operation.go:842 +0x202
github.com/swaggo/swag.(*Operation).ParseComment(0xc0002bc120, {0xc0002cc400, 0x1}, 0x1e351879800)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/operation.go:118 +0x405
github.com/swaggo/swag.(*Parser).ParseRouterAPIInfo(0xc00009c000, {0xc000283d10, 0x24}, 0xc0002d3100)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/parser.go:695 +0x1b9
github.com/swaggo/swag.(*PackagesDefinitions).RangeFiles(0xc000096018, 0xc000127918)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/packages.go:88 +0x1ff
github.com/swaggo/swag.(*Parser).ParseAPIMultiSearchDir(0xc00009c000, {0xc000173c90, 0x1, 0xc000046100}, {0x5c6b37, 0x7}, 0x64)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/parser.go:288 +0x325
github.com/swaggo/swag/gen.(*Gen).Build(0xc000173bc0, 0xc000127c30)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/gen/gen.go:106 +0x2b0
main.initAction(0xc000167860)
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/cmd/swag/main.go:110 +0x39a
github.com/urfave/cli/v2.(*Command).Run(0xc000155560, 0xc000198380)
        D:/gowork/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x64a
github.com/urfave/cli/v2.(*App).RunContext(0xc0001676c0, {0x673c30, 0xc0000180a8}, {0xc00002e3e0, 0x2, 0x2})
        D:/gowork/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x81e
github.com/urfave/cli/v2.(*App).Run(...)
        D:/gowork/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
        D:/gowork/pkg/mod/github.com/swaggo/swag@v1.7.6/cmd/swag/main.go:174 +0x55d

Your swag version
e.g. 1.7.6

Your go version
e.g. 1.17.0

Desktop (please complete the following information):

  • OS: Win10
@ubogdan
Copy link
Contributor

ubogdan commented Dec 1, 2021

I believe this is the same with #1065. Would you mind running the test using the latest dev version and letting us know?

@dreamsxin
Copy link
Author

@ubogdan Again

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0xdc53e2]

goroutine 1 [running]:
github.com/swaggo/swag.(*Operation).DefaultResponse(...)
        D:/workspace/src/swag/operation.go:992
github.com/swaggo/swag.(*Operation).ParseResponseComment(0xc0002ac480, {0xc000224e92, 0x28}, 0xec9ec0)
        D:/workspace/src/swag/operation.go:842 +0x202
github.com/swaggo/swag.(*Operation).ParseComment(0xc0002ac480, {0xc000224e80, 0x1}, 0x8)
        D:/workspace/src/swag/operation.go:118 +0x405
github.com/swaggo/swag.(*Parser).ParseRouterAPIInfo(0xc00009e000, {0xc0002d0540, 0x24}, 0xc0002c4f80)
        D:/workspace/src/swag/parser.go:711 +0x1b9
github.com/swaggo/swag.(*PackagesDefinitions).RangeFiles(0xc000096018, 0xc0001278c8)
        D:/workspace/src/swag/packages.go:88 +0x1ff
github.com/swaggo/swag.(*Parser).ParseAPIMultiSearchDir(0xc00009e000, {0xc000173cf0, 0x1, 0xc000046100}, {0xeb8c22, 0x7}, 0x64)
        D:/workspace/src/swag/parser.go:304 +0x325
github.com/swaggo/swag/gen.(*Gen).Build(0xc000173c10, 0xc000127c20)
        D:/workspace/src/swag/gen/gen.go:135 +0x4b7
main.initAction(0xc00016e1c0)
        D:/workspace/src/swag/cmd/swag/main.go:116 +0x3e5
github.com/urfave/cli/v2.(*Command).Run(0xc000155440, 0xc000198380)
        D:/gowork/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x64a
github.com/urfave/cli/v2.(*App).RunContext(0xc000167860, {0xf661f0, 0xc0000180a8}, {0xc00002e3e0, 0x2, 0x2})
        D:/gowork/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x81e
github.com/urfave/cli/v2.(*App).Run(...)
        D:/gowork/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
        D:/workspace/src/swag/cmd/swag/main.go:181 +0x55d

@ubogdan
Copy link
Contributor

ubogdan commented Dec 1, 2021

Fixed. Please retest and let us know.

@dreamsxin
Copy link
Author

Test passed, Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants