Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: getNextMap to work with v8 #361

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

IgnisAlienus
Copy link
Contributor

[SquadServer][1] Failed to update layer information. TypeError: Cannot read properties of null (reading '1')
at SquadRcon.getNextMap (file:///home/container/squad-server/rcon.js:129:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SquadServer.updateLayerInformation (file:///home/container/squad-server/index.js:452:23)

V8 Updates some RCON Commands it seems

async getNextMap() {
    const response = await this.execute('ShowNextMap');
    const match = response.match(/^Next level is (.*), layer is (.*)/);
    return {
      level: match[1] !== '' ? match[1] : null,
      layer: match[2] !== 'To be voted' ? match[2] : null
    };
  }

the new response from ShowNextMap is Next map is not defined
Therefore match ends up being null which broke the return values.

Updated to this seems to work for me so far:

  async getNextMap() {
    const response = await this.execute('ShowNextMap');
    const match = response.match(/^Next level is (.*), layer is (.*)/);
    return {
      level: match ? (match[1] !== '' ? match[1] : null) : null,
      layer: match ? (match[2] !== 'To be voted' ? match[2] : null) : null
    };
  }

@werewolfboy13 werewolfboy13 added core bug Bug related to the core SquadJS API minor Minor Change labels Jun 12, 2024
@werewolfboy13
Copy link
Collaborator

@IgnisAlienus can you do another change here for me on this PR?

@werewolfboy13
Copy link
Collaborator

"version": "4.0.1",

Can you bump this to "version": "4.1.0",

@werewolfboy13 werewolfboy13 merged commit 78fed13 into Team-Silver-Sphere:master Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core bug Bug related to the core SquadJS API minor Minor Change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants