fix npe for generic types

this only changes behavior that previously greeted with a npe time
bomb, so I am guessing it will be okay.
defaulting to previous behavior for other cases

I find it hard to believe adding null is correct since most
possible results involve NPEs, but it does change the length of
the type list and I believe that _is_ checked in some places.

therefore, rather than completely fix the generic handling of
codec, I am only making sure it works for my case
Merge pull request #3 from addthis/diff-generic-handling

fix npe for generic types