@@ -126,7 +126,7 @@ export class IDBBatchAtomicVFS extends VFS.Base {
126126 } ) ;
127127
128128 // @ts -ignore
129- if ( pOutFlags . buffer . detached ) {
129+ if ( pOutFlags . buffer . detached || ! pOutFlags . buffer . byteLength ) {
130130 pOutFlags = new DataView ( new ArrayBuffer ( 4 ) ) ;
131131 this . #growthHandler = ( pOutFlagsNew ) => {
132132 pOutFlagsNew . setInt32 ( 0 , pOutFlags . getInt32 ( 0 , true ) , true ) ;
@@ -190,7 +190,7 @@ export class IDBBatchAtomicVFS extends VFS.Base {
190190 // write boundaries so we have to allow for that.
191191 const result = await this . #idb. run ( 'readonly' , async ( { blocks} ) => {
192192 // @ts -ignore
193- if ( pData . buffer . detached ) {
193+ if ( pData . buffer . detached || ! pData . buffer . byteLength ) {
194194 // WebAssembly memory has grown, invalidating our buffer. Use
195195 // a temporary buffer and copy after this asynchronous call
196196 // completes.
@@ -477,7 +477,7 @@ export class IDBBatchAtomicVFS extends VFS.Base {
477477 } ;
478478
479479 // @ts -ignore
480- if ( pResOut . buffer . detached ) {
480+ if ( pResOut . buffer . detached || ! pResOut . buffer . byteLength ) {
481481 pResOut = new DataView ( new ArrayBuffer ( 4 ) ) ;
482482 this . #growthHandler = ( pResOutNew ) => {
483483 pResOutNew . setInt32 ( 0 , pResOut . getInt32 ( 0 , true ) , true ) ;
@@ -668,7 +668,7 @@ export class IDBBatchAtomicVFS extends VFS.Base {
668668 } ) ;
669669
670670 // @ts -ignore
671- if ( pResOut . buffer . detached ) {
671+ if ( pResOut . buffer . detached || ! pResOut . buffer . byteLength ) {
672672 pResOut = new DataView ( new ArrayBuffer ( 4 ) ) ;
673673 this . #growthHandler = ( pResOutNew ) => {
674674 pResOutNew . setInt32 ( 0 , pResOut . getInt32 ( 0 , true ) , true ) ;
0 commit comments