Is it possible to prevent the attributes from being updated if the corresponding data is not available in the JSON?

I am reading data (time series of forecast) via a REST API. I put the data in an attribute to then display it in Apex-chart-card. However, it can happen (e.g. if I have stupidly exceeded my quota of requests) that this data is not available. Then, of course, the attribute cannot be filled with data. The old data is then also gone and the chart no longer shows anything. Ideally, the attribute would simply remain unchanged.

You can try to use availability but not sure if this works for attribs

Availability template - Configuration - Home Assistant Community (