Fixed NPE when no type is returned.

Signed-off-by: Timo Kinnunen <timo.kinnunen@gmail.com>