Skip to content

Commit

Permalink
Don't add buffers with an empty name
Browse files Browse the repository at this point in the history
  • Loading branch information
prawnsalad committed Jun 13, 2020
1 parent 52fe1e3 commit b3df871
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libs/BouncerProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ export default class BouncerProvider {
let buffers = await client.bnc.getBuffers(bncNetwork.connection.bncnetid);
buffers.forEach((buffer) => {
let newBuffer = this.state.addBuffer(bncNetwork.id, buffer.name);
if (!newBuffer) {
// The BNC might be giving up bad buffer names or something, so just make sure
// that it's handled if it ever coccurs
log.error(`Couldn't add BNC network, '${buffer.name}'`, buffer);
return;
}

if (buffer.joined) {
newBuffer.enabled = true;
newBuffer.joined = true;
Expand Down
4 changes: 4 additions & 0 deletions src/libs/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ function createNewState() {
},

addBuffer(networkid, bufferName) {
if (!bufferName) {
return false;
}

// If we already have this buffer, don't re-add it
let buffer = this.getBufferByName(networkid, bufferName);
if (buffer) {
Expand Down

0 comments on commit b3df871

Please sign in to comment.