Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default value should not be nil (#2995)
* query/query.go: default value should not be nil types.Marshal expects vars to have non-nil values, this change set empty string as the default value for a referenced aggregate value. This should prevent nil-reference panic in types.Marshal. * query/query.go: retract default value change it breaks aggs. Value var aggregations use nil values for an optimization, so don't assign a value to defaults. * types/conversion.go: add exception in Marshal for default->string The marshaling of default value vars to string causes panic because the incoming value is nil. This affects a narrow case so we check that in fact it's a default value var and marshal to empty string. In theory nothing should be nil by the time we Marshal, but it's an edge case. * wrong issue referenced in comments * types/conversion.go: general case in nil value mashaling If we are trying to mashal a nil value, return the zero value instead of crashing on nil reference. * types/conversion.go: replace the original to-value * types/conversion.go: added check for Marshal to nil object
- Loading branch information