The issue was that `OVERLAY_sculpt_curves_cache_populate` assumes that the object is a curves object, which was not always the case. Now this is checked a bit more explicitly. The solution is still not ideal, because now the cage overlay is not shown at all when the viewer node is used and the result is something else than curves, but that needs to be solved separately.