Fixed: when type was null, it crashed the application
Merge pull request #3 from jsilvestre/master

Fixed: when type was null, it crashed the application