Skip to content

Commit

Permalink
Add guard to possibly null variable
Browse files Browse the repository at this point in the history
  • Loading branch information
walidkayhan committed Jan 10, 2024
1 parent e3c655d commit d3e7db5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/services/cncengine/CNCEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class CNCEngine {

// Close serial port
socket.on('close', (port, callback = noop) => {
const numClients = socket.adapter.rooms.get(port).size;
const numClients = socket.adapter.rooms?.get(port)?.size;
if (typeof callback !== 'function') {
callback = noop;
}
Expand Down

0 comments on commit d3e7db5

Please sign in to comment.