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

fix(resolve): Check val not nil in resolve funcs #2097

Merged
merged 1 commit into from
Aug 1, 2022

Conversation

chmnchiang
Copy link
Contributor

Description

We did not check val ~= nil in the resolve functions, so config like { nil, max = 30 } will throw a nil error. Also, if the config is { padding = _ }, the logic relies on the function handling the padding is iterated before the one handling min/max in the map, which is not always guaranteed.

Fix the bug by adding nil check in the function handling min/max. Close

Fixes #2091

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

We did not check `val ~= nil` in the resolve functions, so config like
`{ nil, max = 30 }` will throw a nil error. Also, if the config is `{
padding = _ }`, the logic relies on the function handling the padding is
iterated before the one handling min/max in the map, which is not always
guaranteed.

Fix the bug by adding nil check in the function handling min/max. Close
Copy link
Member

@Conni2461 Conni2461 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks :)

@Conni2461 Conni2461 merged commit 75a5e50 into nvim-telescope:master Aug 1, 2022
Conni2461 pushed a commit that referenced this pull request Aug 1, 2022
We did not check `val ~= nil` in the resolve functions, so config like
`{ nil, max = 30 }` will throw a nil error. Also, if the config is `{
padding = _ }`, the logic relies on the function handling the padding is
iterated before the one handling min/max in the map, which is not always
guaranteed.

Fix the bug by adding nil check in the function handling min/max. Close

(cherry picked from commit 75a5e50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error executing ... config/resolve.lua:143: attempt to compare number with nil
2 participants