1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

Handle exceptions when emojifier fails to provide uri for emoji icon (#856)

This commit is contained in:
Evgenii Kozlov 2020-09-14 16:36:35 +02:00 committed by GitHub
parent 2d46bb52ad
commit 376b9a77a8
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 25 deletions

View file

@ -13,6 +13,7 @@ object Emojifier {
* @param unicode emoji unicode
* @return uri for loading emoji as image
*/
@Throws(IllegalStateException::class)
fun uri(unicode: String): String {
val (page, index) = search(unicode)
return uri(page, index)
@ -31,6 +32,7 @@ object Emojifier {
* @param unicode emoji unicode
* @return a pair constisting of emoji's page and emoji's index for this [unicode]
*/
@Throws(IllegalStateException::class)
private fun search(unicode: String): Pair<Int, Int> {
val cached = cache[unicode]