Updated toValue to properly handle nil pointers

I encountered errors when calling `toValue` on a nil pointer (panic: reflect: call of reflect.Value.Interface on zero Value)

When debugging this error I found that the value being passed to `toValue` was `(*html.Node)(<nil>)`. This code fixes this panic however there might be a better place to put the check.