Skip to content

Commit d38c5b3

Browse files
committed
fix: dumped buffer must not be empty
1 parent becb25b commit d38c5b3

File tree

7 files changed

+24
-0
lines changed

7 files changed

+24
-0
lines changed

src/pc/1.13/ChunkColumn.js

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ module.exports = (Block, mcData) => {
199199
smartBuffer.writeInt32BE(biome)
200200
})
201201

202+
if (!smartBuffer.length) {
203+
return Buffer.alloc(4096)
204+
}
205+
202206
return smartBuffer.toBuffer()
203207
}
204208

src/pc/1.14/ChunkColumn.js

+4
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ module.exports = (Block, mcData) => {
221221
smartBuffer.writeInt32BE(biome)
222222
})
223223

224+
if (!smartBuffer.length) {
225+
return Buffer.alloc(4096)
226+
}
227+
224228
return smartBuffer.toBuffer()
225229
}
226230

src/pc/1.15/ChunkColumn.js

+3
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ module.exports = (Block, mcData) => {
210210
section.write(smartBuffer)
211211
}
212212
})
213+
if (!smartBuffer.length) {
214+
return Buffer.alloc(4096)
215+
}
213216
return smartBuffer.toBuffer()
214217
}
215218

src/pc/1.16/ChunkColumn.js

+3
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ module.exports = (Block, mcData) => {
210210
section.write(smartBuffer)
211211
}
212212
})
213+
if (!smartBuffer.length) {
214+
return Buffer.alloc(4096)
215+
}
213216
return smartBuffer.toBuffer()
214217
}
215218

src/pc/1.17/ChunkColumn.js

+3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ module.exports = (Block, mcData) => {
251251
section.write(smartBuffer)
252252
}
253253
})
254+
if (!smartBuffer.length) {
255+
return Buffer.alloc(4096)
256+
}
254257
return smartBuffer.toBuffer()
255258
}
256259

src/pc/1.18/ChunkColumn.js

+3
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ module.exports = (Block, mcData) => {
233233
this.sections[i].write(smartBuffer)
234234
this.biomes[i].write(smartBuffer)
235235
}
236+
if (!smartBuffer.length) {
237+
return Buffer.alloc(4096)
238+
}
236239
return smartBuffer.toBuffer()
237240
}
238241

src/pc/1.9/ChunkColumn.js

+4
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ module.exports = (Block, mcData) => {
183183
smartBuffer.writeUInt8(biome)
184184
})
185185

186+
if (!smartBuffer.length) {
187+
return Buffer.alloc(4096)
188+
}
189+
186190
return smartBuffer.toBuffer()
187191
}
188192

0 commit comments

Comments
 (0)