fixed part of split/merge logic

This commit is contained in:
Kevin Jahns
2019-04-08 13:41:28 +02:00
parent 7a111de186
commit e1a9f314a7
8 changed files with 39 additions and 29 deletions

View File

@@ -98,7 +98,7 @@ export const addStruct = (store, struct) => {
*/
export const findIndexSS = (structs, clock) => {
let left = 0
let right = structs.length
let right = structs.length - 1
while (left <= right) {
const midindex = math.floor((left + right) / 2)
const mid = structs[midindex]
@@ -112,6 +112,8 @@ export const findIndexSS = (structs, clock) => {
right = midindex - 1
}
}
// Always check state before looking for a struct in StructStore
// Therefore the case of not finding a struct is unexpected
throw error.unexpectedCase()
}