Rantanen / node-mumble

Mumble client in Node.js
MIT License
155 stars 48 forks source link

TypeError: Cannot read property 'session' of undefined #36

Closed timeDev closed 9 years ago

timeDev commented 9 years ago

Calling MumbleClient.sendMessage will always yield this error, because of the way it is written:

if( !packet.session && !packet.channelId ) {
    return console.error(
        "Recipients not specified for sending text messages.\n" +
        "client.sendMessage isn't used for sending protobuf messages anymore.\n" +
        "Use client.connection.sendMessage for raw protobuf messages." );
}

var packet = {
    actor: this.session,
    message: message
};
// ...

The packet variable is being hoisted, so it will always be undefined when packet.session is being accessed. I think packetis supposed to be recipient.