JoinColony / colonyCDapp

An iteration of the Colony Dapp sporting both a fully decentralized operating mode, as well as a mode enhanced by a metadata caching layer
5 stars 14 forks source link

Fix: Advanced payments crashing due to unsafe array access #3678

Closed jakubcolony closed 4 days ago

jakubcolony commented 1 week ago

Description

This small PR fixes unsafe array access when generating action description.

I came across a case where a newly created expenditure gets returned from the DB, but it does not yet have any slots (block-ingestor has not processed them yet). In such a scenario, the entire app would crash due to it trying to read the recipient of the first slot.

It would also be possible to run into this issue when an empty expenditure is created, such as in #3302 or through direct contract interaction (it is possible to create an expenditure with 0 slots).

Testing

Create a couple of advanced payments and confirm the app does not crash.

Resolves #3677