Error 500 when generating client statement

I’m getting an error when I try to create a client statement that has no sent invoice. Every time I try to view the statement I receive a 500 Error response. But everything works okay once I assign an invoice to a client and send it. What I understood is that this error is related to a client not having a sent invoice. I’m running v5.3.49-C73 on shared hosting and I’am using phantomJS with a custom secret key.
Help Please.

Log:
[2022-01-25 22:33:57] production.INFO: db fails
[2022-01-25 22:35:43] production.INFO: http://inv.icode.tn/phantom/invoice/7uWzumoy5VtwkzGkOHkjKQ2nqK3DMtnr?phantomjs_secret=secret
[2022-01-25 22:36:02] production.ERROR: Trying to get property ‘cost’ of non-object {“userId”:1,“exception”:"[object] (ErrorException(code: 0): Trying to get property ‘cost’ of non-object at /home/u120380175/domains/icode.tn/public_html/inv/app/Services/Client/Statement.php:179)

Hi,

Thanks for reporting this!

cc @david

This would occur if you have no products in your system at all.

It is an unusual edge case, but we’ll get a fix in for this.

Yes exactly, was able to solve it by adding a product. Thank you