mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-12 23:43:42 +01:00
lib/client: ensure server prefix is never null
Fixes a null deref in handleChatMessage, because incoming message prefixes are populated with the server's if null.
This commit is contained in:
parent
3b383308d4
commit
8f29f0c35d
@ -49,6 +49,8 @@ const WHOX_FIELDS = {
|
|||||||
"realname": "r",
|
"realname": "r",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const FALLBACK_SERVER_PREFIX = { name: "*" };
|
||||||
|
|
||||||
let lastLabel = 0;
|
let lastLabel = 0;
|
||||||
let lastWhoxToken = 0;
|
let lastWhoxToken = 0;
|
||||||
|
|
||||||
@ -108,7 +110,7 @@ export default class Client extends EventTarget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
status = Client.Status.DISCONNECTED;
|
status = Client.Status.DISCONNECTED;
|
||||||
serverPrefix = { name: "*" };
|
serverPrefix = FALLBACK_SERVER_PREFIX;
|
||||||
nick = null;
|
nick = null;
|
||||||
supportsCap = false;
|
supportsCap = false;
|
||||||
caps = new irc.CapRegistry();
|
caps = new irc.CapRegistry();
|
||||||
@ -190,7 +192,7 @@ export default class Client extends EventTarget {
|
|||||||
this.ws = null;
|
this.ws = null;
|
||||||
this.setStatus(Client.Status.DISCONNECTED);
|
this.setStatus(Client.Status.DISCONNECTED);
|
||||||
this.nick = null;
|
this.nick = null;
|
||||||
this.serverPrefix = null;
|
this.serverPrefix = FALLBACK_SERVER_PREFIX;
|
||||||
this.caps = new irc.CapRegistry();
|
this.caps = new irc.CapRegistry();
|
||||||
this.batches = new Map();
|
this.batches = new Map();
|
||||||
Object.keys(this.pendingCmds).forEach((k) => {
|
Object.keys(this.pendingCmds).forEach((k) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user