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

Prevent nil pointer dereference in dashboard import #630

Merged

Commits on Aug 10, 2020

  1. Prevent nil pointer dereference in dashboard import

    When importing a dashboard with a template variable with no prefix, the
    provider panics with the following error message:
    
    ```
    panic: runtime error: invalid memory address or nil pointer dereference
    2020-08-10T13:42:16.345+0200 [DEBUG] plugin.terraform-provider-datadog_v2.12.1: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1bddcf1]
    2020-08-10T13:42:16.345+0200 [DEBUG] plugin.terraform-provider-datadog_v2.12.1:
    2020-08-10T13:42:16.345+0200 [DEBUG] plugin.terraform-provider-datadog_v2.12.1: goroutine 81 [running]:                                                                                                     2020-08-10T13:42:16.345+0200 [DEBUG] plugin.terraform-provider-datadog_v2.12.1: github.com/terraform-providers/terraform-provider-datadog/datadog.buildTerraformTemplateVariables(0xc0004a1a18, 0x1fa2ab9)
    2020-08-10T13:42:16.345+0200 [DEBUG] plugin.terraform-provider-datadog_v2.12.1:         github.com/terraform-providers/terraform-provider-datadog/datadog/resource_datadog_dashboard.go:296 +0x291
    ```
    
    This commit prevents by first checking if the pointer that we're going
    to dereference is nil. If that's the case, we assume that the template
    variable doesn't have a name, prefix or default, as appropriate.
    juliogreff committed Aug 10, 2020
    Configuration menu
    Copy the full SHA
    ea19573 View commit details
    Browse the repository at this point in the history