Skip to content

Commit 5f12487

Browse files
committed
fix(opencode): validate diffs is array in SessionSummary.diff
The storage layer can return malformed data where diffs is not an array. Added Array.isArray validation to return empty array instead of crashing when calling .map() on non-array data. Fixes anomalyco#19270
1 parent 7da7d7c commit 5f12487

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎packages/opencode/src/session/summary.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export namespace SessionSummary {
127127
}),
128128
async (input) => {
129129
const diffs = await Storage.read<Snapshot.FileDiff[]>(["session_diff", input.sessionID]).catch(() => [])
130+
if (!Array.isArray(diffs)) return []
130131
const next = diffs.map((item) => {
131132
const file = unquoteGitPath(item.file)
132133
if (file === item.file) return item

0 commit comments

Comments
 (0)