From cd9617af45cedb671ac15dd611cff0fbe6e2b1a4 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sun, 4 Feb 2024 12:30:06 +0000 Subject: [PATCH] Test talk track is not empty before pulling state --- src/Scheduler.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Scheduler.ts b/src/Scheduler.ts index a943f82..20d9b61 100644 --- a/src/Scheduler.ts +++ b/src/Scheduler.ts @@ -381,10 +381,12 @@ export class Scheduler { ); try { - const nameEventContent = await this.client.getRoomStateEvent(confAud.roomId, "m.room.name", ""); - if (task.talk.track != '' && task.talk.track != undefined && task.talk.track != nameEventContent["name"]) { - nameEventContent["name"] = task.talk.track; - await this.client.sendStateEvent(confAud.roomId, "m.room.name", "", nameEventContent); + if (task.talk.track != '' && task.talk.track != undefined) { + const nameEventContent = await this.client.getRoomStateEvent(confAud.roomId, "m.room.name", ""); + if (task.talk.track != nameEventContent["name"]) { + nameEventContent["name"] = task.talk.track; + await this.client.sendStateEvent(confAud.roomId, "m.room.name", "", nameEventContent); + } } } catch (e) { LogService.error("Scheduler:talkStart", `Error when considering changing name of track room`, e);