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

when a resource is null v9 panics #1565

Closed
chris-rock opened this issue Aug 22, 2023 · 1 comment
Closed

when a resource is null v9 panics #1565

chris-rock opened this issue Aug 22, 2023 · 1 comment
Labels
Milestone

Comments

@chris-rock
Copy link
Member

Describe the bug

When I define a async method in lr like:

resource {
  license() anotherResource
}

And the method returns nil, it panics. This is caused by the fact that the generated code does not check for nil

func (c *mqlGithubLicense) GetKey() *plugin.TValue[string] {
	return &c.Key
}

func (c *mqlGithubLicense) GetName() *plugin.TValue[string] {
	return &c.Name
}

To Reproduce

cnquery shell github repo lunalectric/online-shop
$ github.repository { id closedIssues license } 

Expected behavior

nil should just be ok

@chris-rock chris-rock added the v9 label Aug 22, 2023
@chris-rock chris-rock added this to the v9 milestone Sep 17, 2023
@czunker
Copy link
Contributor

czunker commented Sep 18, 2023

Fixed with #1726:

cnquery run github repo lunalectric/backend -c "github.repository { id closedIssues license }"                                          ✔ │ 4s │ 11:22:47 
→ loaded configuration from /etc/opt/mondoo/mondoo.yml using source default
1 error occurred:
	* not found
github.repository: {
  id: 509600275
  closedIssues: [
  0: github.issue title="🐛 Use fixed action"
  1: github.issue title="Update the pg example to make it all work"
  2: github.issue title="Add postgresql manifest + testing"
  ]
  license: not found
}

@czunker czunker closed this as completed Sep 18, 2023
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