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

Plush Panics when accessing a map with a key that's not comparable with the map index #176

Closed
Mido-sys opened this issue Mar 10, 2023 · 2 comments · Fixed by #177
Closed

Comments

@Mido-sys
Copy link
Contributor

This code panics:

	input := `<%= m["first"]%>`
	_, err := Render(input, NewContextWith(map[string]interface{}{

		"m": map[int]bool{0: true},
	}))
panic: reflect.Value.MapIndex: value of type int is not assignable to type string

goroutine 27183 [running]:
reflect.Value.assignTo({0x1000620?, 0x1b13820?, 0xc0005348d0?}, {0x11ee87f, 0x16}, 0x10010e0, 0x0)
	/usr/local/go/src/reflect/value.go:3064 +0x2ac
reflect.Value.MapIndex({0x1049700?, 0xc000d9c540?, 0xc0008feb40?}, {0x1000620, 0x1b13820, 0x82})
	/usr/local/go/src/reflect/value.go:1609 +0xed
github.com/gobuffalo/plush/v4.(*compiler).evalAccessIndex(0x10071?, {0x1049700?, 0xc000d9c540?}, {0x1000620?, 0x1b13820?}, 0xc0004f87e0)
	/home/------/----/pkg/mod/github.com/gobuffalo/plush/v4@v4.1.17/compiler.go:323 +0x18a
@Mido-sys
Copy link
Contributor Author

@sio4 @paganotoni , I sent a PR to fix this issue. Kindly check the pull request. We discovered that bug and hope to get the PR merged :)

@Mido-sys
Copy link
Contributor Author

@paganotoni Thank you :)

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 a pull request may close this issue.

1 participant