One thing is missing: you need to check if a matched gen jet actually exists before you apply the smearing.
Otherwise you will get a get with 0 energy and momentum (therefore eta = inf) which you try to use for smearing.
Is the smearing function robust enough if you pass it such a jet?