Avoid NPE when 'origin' parameter not present

NPE is thrown in `origin.trim()` line.
Merge pull request #307 from nurkiewicz/patch-1

Avoid NPE when 'origin' parameter not present