Fix: Prevent crash in cachingAtDepthForOpenRouterClaude on empty content from trailing tool calls (#5541) * Prevent crash in cachingAtDepthForOpenRouterClaude when message has no text * Apply optional chaining suggestion

940b3722cf80d3b4dd0855c5b70c167311299b28

crsp6447 <crsp6447@pm.me>

Signed
1 files changed, +1 -1Ignore whitespace
src/prompt-converters.js+1 -1
@@ -1040,7 +1040,7 @@ export function cachingAtDepthForOpenRouterClaude(messages, cachingAtDepth, ttl)
1040 text: content,1040 text: content,
1041 cache_control: { type: 'ephemeral', ttl: ttl },1041 cache_control: { type: 'ephemeral', ttl: ttl },
1042 }];1042 }];
1043 } else {1043 } else if (content?.length > 0) {
1044 const contentPartCount = content.length;1044 const contentPartCount = content.length;
1045 content[contentPartCount - 1].cache_control = {1045 content[contentPartCount - 1].cache_control = {
1046 type: 'ephemeral',1046 type: 'ephemeral',