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 panic I see when upgrading to 0.6.6 #3751

Closed
wants to merge 1 commit into from

Conversation

bobtfish
Copy link
Contributor

@bobtfish bobtfish commented Nov 4, 2015

Check if the policy is nil or not before type casting it

Otherwise I get this error:

panic: interface conversion: interface is nil, not string
2015/11/04 04:02:04 [DEBUG] terraform-provider-aws:
2015/11/04 04:02:04 [DEBUG] terraform-provider-aws: goroutine 263 [running]:
2015/11/04 04:02:04 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.func·123(0x0, 0x0, 0x0, 0x0)
2015/11/04 04:02:04 [DEBUG] terraform-provider-aws:     /root/build/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_sns_topic.go:50 +0x64
2015/11/04 04:02:04 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/helper/schema.schemaMap.diffString(0xc2090603f0, 0x112aab0, 0x6, 0xc20906c5b0, 0xc20910b050, 0xc2091443c0, 0xc20906c400, 0x0, 0x0)

Check if the policy is nil or not before type casting it
@catsby
Copy link
Contributor

catsby commented Nov 4, 2015

Great catch! Do you think we should just immediately return "" if v is nil?

@apparentlymart
Copy link
Contributor

I remember we were discussing this on some other ticket somewhere (I couldn't find it after a quick search) and a bunch of us concluded and agreed that StateFunc ought to be called only for non-null values, after a bug very similar to this. We couldn't find ause-case for transforming nulls, especially since the callback is required to return a string anyway and so couldn't normalize to null.

So +1 from me on that!

@catsby
Copy link
Contributor

catsby commented Nov 5, 2015

Continued in #3777 where I make a small change, thanks!

@catsby catsby closed this Nov 5, 2015
@ghost
Copy link

ghost commented Apr 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants