Kord-Extensions/kord-extensions

EmojiConverter will crash with a normal emoji

Doomsdayrs opened this issue · 4 comments

Description

Line 79 of EmojiConverter causes a crash.

Hello, and thanks for opening an issue! As this is the first time you've created an issue on this repository, we'd just like to offer you a warm welcome to the project, and the following pointers:

  • Most importantly, all issues must adhere to our Code of Conduct. Please give it a quick read if you haven't already.

  • While our team is passionate about the projects we've created here, we're all volunteers. Please don't be offended if it takes time for us to get to your issue - we'll be here as soonas we can be!

  • Please provide as much information as possible when asking a question, reporting a problem, or submitting a feature request. This will help us to address your issue quickly and efficiently. If you forgot to add some information, no worries - feel free to edit the issue and add anything you missed!

    Thanks for contacting us! If you have any further questions, please feel free to join us on Discord in the #dev-kotdis channel (or #kordex-discussion for Kord Extensions projects), or to contact a staff member directly.

This issue doesn't have close to enough information. What version of KordEx are you using? What exception is being thrown? Can you provide logs or more context?

This issue doesn't have close to enough information. What version of KordEx are you using? What exception is being thrown? Can you provide logs or more context?

I just use +, so latest. Asides the link is right from the latest git.

NoSuchElementException

Exception in thread "DefaultDispatcher-worker-6" java.util.NoSuchElementException: Expected at least one element matching the predicate (dev.kord.core.entity.GuildEmoji) -> kotlin.Boolean
	at kotlinx.coroutines.flow.FlowKt__ReduceKt.first(Reduce.kt:114)
	at kotlinx.coroutines.flow.FlowKt.first(Unknown Source)
	at com.kotlindiscord.kord.extensions.commands.converters.impl.EmojiConverter$findEmoji$$inlined$mapNotNull$3$2.emit(Emitters.kt:224)
	at kotlinx.coroutines.flow.FlowKt__EmittersKt$onEmpty$1$1.emit(Emitters.kt:185)
	at dev.kord.core.supplier.CacheEntitySupplier$special$$inlined$map$2$2.emit(Emitters.kt:224)
	at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
	at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
	at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
	at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
	at dev.kord.cache.map.MapLikeCollection$Companion$from$1$values$1.invokeSuspend(MapLikeCollection.kt:89)
	at dev.kord.cache.map.MapLikeCollection$Companion$from$1$values$1.invoke(MapLikeCollection.kt)
	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
	at dev.kord.core.supplier.CacheEntitySupplier$special$$inlined$map$2.collect(SafeCollector.common.kt:113)
	at kotlinx.coroutines.flow.FlowKt__EmittersKt$onEmpty$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
	at com.kotlindiscord.kord.extensions.commands.converters.impl.EmojiConverter$findEmoji$$inlined$mapNotNull$3.collect(SafeCollector.common.kt:113)
	at kotlinx.coroutines.flow.FlowKt__ReduceKt.firstOrNull(Reduce.kt:228)
	at kotlinx.coroutines.flow.FlowKt.firstOrNull(Unknown Source)
	at com.kotlindiscord.kord.extensions.commands.converters.impl.EmojiConverter.findEmoji(EmojiConverter.kt:89)
	at com.kotlindiscord.kord.extensions.commands.converters.impl.EmojiConverter.parseOption(EmojiConverter.kt:99)
	at com.kotlindiscord.kord.extensions.commands.application.slash.SlashCommandParser.parse(SlashCommandParser.kt:82)
	at com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommand.run(PublicSlashCommand.kt:96)
	at com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommand$run$1.invokeSuspend(PublicSlashCommand.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@797bf9b1, Dispatchers.Default]

Thanks for the PR!