Skip to content

runtime.Fetch: add string type assertion check before trying to check if the value is a method #349

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

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

blotus
Copy link
Contributor

@blotus blotus commented Mar 9, 2023

Fixes #346.

I'm not familiar enough with expr internals to know if this fixes the issue or hides the underlying cause.

Feel free to close it if you have a better solution.

method := v.MethodByName(i.(string))
if method.IsValid() {
return method.Interface()
if methodName, ok := i.(string); ok {
Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is the right solution 👍🏻

@antonmedv antonmedv merged commit 5613693 into expr-lang:master Mar 9, 2023
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.

interface conversion: interface {} is int, not string when trying to index slice type
2 participants