(bug): Check if structs are empty before findIndexSS and writing encoding.
This commit is contained in:
parent
28ccd5e0dd
commit
058e93d191
@ -194,6 +194,7 @@ export const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) =
|
|||||||
getItemCleanStart(transaction, createID(client, clock))
|
getItemCleanStart(transaction, createID(client, clock))
|
||||||
}
|
}
|
||||||
const structs = originDoc.store.clients.get(client) || []
|
const structs = originDoc.store.clients.get(client) || []
|
||||||
|
if(structs.length != 0) {
|
||||||
const lastStructIndex = findIndexSS(structs, clock - 1)
|
const lastStructIndex = findIndexSS(structs, clock - 1)
|
||||||
// write # encoded structs
|
// write # encoded structs
|
||||||
encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1)
|
encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1)
|
||||||
@ -204,6 +205,7 @@ export const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) =
|
|||||||
structs[i].write(encoder, 0)
|
structs[i].write(encoder, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
writeDeleteSet(encoder, ds)
|
writeDeleteSet(encoder, ds)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user