mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Properly handle empty fragments for MOBI (#107)
This commit is contained in:
@@ -994,7 +994,7 @@ class KF8 {
|
|||||||
const last = arr[arr.length - 1]
|
const last = arr[arr.length - 1]
|
||||||
const fragStart = last?.fragEnd ?? 0, fragEnd = fragStart + skel.numFrag
|
const fragStart = last?.fragEnd ?? 0, fragEnd = fragStart + skel.numFrag
|
||||||
const frags = fragTable.slice(fragStart, fragEnd)
|
const frags = fragTable.slice(fragStart, fragEnd)
|
||||||
const length = skel.length + frags.map(f => f.length).reduce((a, b) => a + b)
|
const length = skel.length + frags.map(f => f.length).reduce((a, b) => a + b, 0)
|
||||||
const totalLength = (last?.totalLength ?? 0) + length
|
const totalLength = (last?.totalLength ?? 0) + length
|
||||||
return arr.concat({ skel, frags, fragEnd, length, totalLength })
|
return arr.concat({ skel, frags, fragEnd, length, totalLength })
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
Reference in New Issue
Block a user