Applied bug fix from trunk r1626399.
[OFBIZ-3879] Patch from the jira issue resolves the problem. Now start rendering invoice only if valid data if found in the database. 
Code needs reformatting.
Thanks Deepak Dixit for the contribution.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/release13.07@1626403 13f79535-47bb-0310-9956-ffa450edef68