Skip to content

Commit

Permalink
style: merge if tree into ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
TTtie committed Nov 2, 2024
1 parent c848828 commit ae0a69c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/voice/VoiceConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,8 @@ class VoiceConnection extends EventEmitter {
this.secret
);

if(Sodium.native) {
data = d.buffer;
} else {
// The Buffer instance isn't guaranteed to be stable when in WASM, therefore a full copy is needed
data = Buffer.from(d.buffer);
}
// SAFE: the native backend has no concept of freeing memory, so the buffer can be used directly
data = Sodium.native ? d.buffer : Buffer.from(d.buffer);

msgPtr.free();
d.free();
Expand Down

0 comments on commit ae0a69c

Please sign in to comment.