Error: Attempt to get attribute from null value

I need help understanding this behaviour.

I have a module with the following variable

variable "nodepool_config" {
  type = object({
    enable_auto_scaling          = optional(bool, true)
    min_count                    = optional(number, 1)
    max_count                    = optional(number, 5)
  })
  default = {}
}

When I call the module and set nodepool_config = null I get the error

Error: Attempt to get attribute from null value

var.nodepool_config.max_count : null
var.nodepool_config is null
This value is null, so it does not have any attributes.

I was expecting that if I set nodepool_config = null it would use the default {} and therefore the attributes would also use the optional default values??

Nevermind. I just realised I had to set nullable = false on the variable for it to work.