forked from CringeStudios/gamja
store: protect against dup buffers
This commit is contained in:
parent
c8fda8ed53
commit
5db0105dbd
6
store.js
6
store.js
@ -130,12 +130,18 @@ export class Buffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
list(server) {
|
list(server) {
|
||||||
|
// Some gamja versions would store the same buffer multiple times
|
||||||
|
let names = new Set();
|
||||||
let buffers = [];
|
let buffers = [];
|
||||||
for (const buf of this.m.values()) {
|
for (const buf of this.m.values()) {
|
||||||
if (buf.server.bouncerNetwork !== server.bouncerNetwork) {
|
if (buf.server.bouncerNetwork !== server.bouncerNetwork) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (names.has(buf.name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
buffers.push(buf);
|
buffers.push(buf);
|
||||||
|
names.add(buf.name);
|
||||||
}
|
}
|
||||||
return buffers;
|
return buffers;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user