prevent crash when creating new invoice
Merge branch 'master' into events