fix: guard charRow[0] in tickDeathTimers; remove redundant cast
This commit is contained in:
parent
612843da39
commit
0cf3e4583c
1 changed files with 2 additions and 1 deletions
|
|
@ -113,7 +113,7 @@ async function tickDeathTimers(io: Server, campaignId: number): Promise<void> {
|
||||||
);
|
);
|
||||||
if (charRows.length === 0) return;
|
if (charRows.length === 0) return;
|
||||||
|
|
||||||
const charIds = (charRows as RowDataPacket[]).map((r) => r.id as number);
|
const charIds = charRows.map((r) => r.id as number);
|
||||||
const placeholders = charIds.map(() => "?").join(", ");
|
const placeholders = charIds.map(() => "?").join(", ");
|
||||||
|
|
||||||
const [dyingRows] = await db.execute<RowDataPacket[]>(
|
const [dyingRows] = await db.execute<RowDataPacket[]>(
|
||||||
|
|
@ -145,6 +145,7 @@ async function tickDeathTimers(io: Server, campaignId: number): Promise<void> {
|
||||||
"SELECT * FROM character_conditions WHERE character_id = ?",
|
"SELECT * FROM character_conditions WHERE character_id = ?",
|
||||||
[condition.character_id]
|
[condition.character_id]
|
||||||
);
|
);
|
||||||
|
if (!charRow[0]) continue;
|
||||||
io.to(`campaign:${campaignId}`).emit("character:updated", {
|
io.to(`campaign:${campaignId}`).emit("character:updated", {
|
||||||
...charRow[0],
|
...charRow[0],
|
||||||
conditions: updatedConditions,
|
conditions: updatedConditions,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue