Use reflect.Value.String() rather than a type assertion.

Fixes a panic in hashstructure/auditing that can occur with custom
string types.

Fixes #973
This commit is contained in:
Jeff Mitchell 2016-01-26 12:32:50 -05:00
parent 1dc52267a8
commit 7876b8b7fe

View File

@ -186,7 +186,7 @@ func (w *hashWalker) Primitive(v reflect.Value) error {
return nil
}
replaceVal := w.Callback(v.Interface().(string))
replaceVal := w.Callback(v.String())
resultVal := reflect.ValueOf(replaceVal)
switch w.loc {