Null pointer exception when serializing object with null field AND while using hooks and type selectors #25
Description
I've mostly been using GSON and gson-fire for deserialization, and I've had no problems with that. However, I've been having a following problem when trying to serialize data. I've tried using the same GSON instance I use for deseriailzation, and this istance has hooks and a type selector enabled. When trying to serialize object that has a null value in one of his variables (both the object and the null attribute being of types covered by my custom type selector), I get a null pointer exception at HooksInvoker class, line 47. When I disable hooks, I get an exception at TypeSelectorTypeAdapterFactory, line 48. In both cases value/object variables are null when processing reaches the null object which is a part of the object being seriailzed.
I've momentarily solved this by using a different GSON instance for serialization, which doesn't use hooks nor type selection but that might not work for me in the future, and this seems to be a bug of some kind. At the very least, I think that hooks should totaly be ignored if object is null. Probably something similar should be done with the type selection.
Your library was otherwise very helpful to me, and I'm hoping you'll take a look at this. Thanks!