reorder SendPrivateMessage and add a null check
This commit is contained in:
parent
fc374c8932
commit
eea27b25f8
1 changed files with 3 additions and 2 deletions
|
@ -3,6 +3,9 @@ const osu = require("osu-packet"),
|
|||
|
||||
module.exports = function(CurrentUser, CurrentPacket) {
|
||||
const osuPacketWriter = new osu.Bancho.Writer;
|
||||
const userSentTo = getUserByUsername(CurrentPacket.data.target);
|
||||
|
||||
if (userSentTo == null) return;
|
||||
|
||||
osuPacketWriter.SendMessage({
|
||||
sendingClient: CurrentUser.username,
|
||||
|
@ -11,8 +14,6 @@ module.exports = function(CurrentUser, CurrentPacket) {
|
|||
senderId: CurrentUser.id
|
||||
});
|
||||
|
||||
const userSentTo = getUserByUsername(CurrentPacket.data.target);
|
||||
|
||||
// Write chat message to stream asociated with chat channel
|
||||
return userSentTo.addActionToQueue(osuPacketWriter.toBuffer);
|
||||
}
|
Loading…
Reference in a new issue