-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Trying to send a text message is giving null pointer exception
Current Implmentation
override suspend fun sendChatMessage(
msg: String,
chatMessageAdapter: JsonAdapter<LivekitChatMessageModel>,
) {
Timber.i("LiveKitClientManager.sendChatMessage: $msg")
if (lkRoom != null && lkRoom?.localParticipant?.identity != null) {
try {
val streamSender =
lkRoom!!
.localParticipant
.streamText(
options =
StreamTextOptions(
topic = "lk.chat",
operationType = TextStreamInfo.OperationType.CREATE,
)
)
streamSender.write(msg)
streamSender.close()
} catch (e: Exception) {
Timber.e(e, "LiveKitClientManager.sendChatMessage: msg: $msg")
}
} else {
Timber.e(IllegalStateException("Null Room"), "LiveKitClientManager.sendChatMessage: ")
}
}
Exception
LiveKitClientManager E LiveKitClientManager.sendChatMessage: msg: test (Ask Gemini)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at livekit.LivekitModels$DataStream$TextHeader.setReplyToStreamId(LivekitModels.java:34406)
at livekit.LivekitModels$DataStream$TextHeader.access$73000(LivekitModels.java:34280)
at livekit.LivekitModels$DataStream$TextHeader$Builder.setReplyToStreamId(LivekitModels.java:34825)
at io.livekit.android.room.datastream.outgoing.OutgoingDataStreamManagerImpl.openStream(OutgoingDataStreamManager.kt:101)
at io.livekit.android.room.datastream.outgoing.OutgoingDataStreamManagerImpl.streamText(OutgoingDataStreamManager.kt:179)
at io.livekit.android.room.participant.LocalParticipant.streamText(Unknown Source:2)
at com.test.test.webrtc.LiveKitClientManager.sendChatMessage(LiveKitClientManager.kt:215)
at com.test.test.chat.text.TextInputStateHolder$ask$1.invokeSuspend(TextInputStateHolder.kt:148)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
Device Info:
- Device: All devices and emulators
- OS: Andreid 13, 15
- LiveKit SDK version: 2.15.0
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working