Hi everyone, I'm looking for help I'm getting an e...
# multiplatform
e
Hi everyone, I'm looking for help I'm getting an error when running my CMP app on iOS
Copy code
Uncaught Kotlin exception: kotlin.ArrayIndexOutOfBoundsException
The issue is with the lexendFontFamily variable if I comment it out, the app runs normally.
Copy code
@Composable
fun rememberLexendTypography(): Typography {
    val lexendFontFamily = FontFamily(
        Font(resource = Res.font.lexend_light, weight = FontWeight.Light),
        Font(resource = Res.font.lexend_regular, weight = FontWeight.Normal),
        Font(resource = Res.font.lexend_medium, weight = FontWeight.Medium),
        Font(resource = Res.font.lexend_semibold, weight = FontWeight.SemiBold),
        Font(resource = Res.font.lexend_bold, weight = FontWeight.Bold),
        Font(resource = Res.font.lexend_black, weight = FontWeight.Black),
    )
    return MaterialTheme.typography.let { typography ->
        typography.copy(
            displayLarge = typography.displayLarge.copy(fontFamily = lexendFontFamily),
            displayMedium = typography.displayMedium.copy(fontFamily = lexendFontFamily),
            displaySmall = typography.displaySmall.copy(fontFamily = lexendFontFamily),
            headlineLarge = typography.headlineLarge.copy(fontFamily = lexendFontFamily),
            headlineMedium = typography.headlineMedium.copy(fontFamily = lexendFontFamily),
            headlineSmall = typography.headlineSmall.copy(fontFamily = lexendFontFamily),
            titleLarge = typography.titleLarge.copy(fontFamily = lexendFontFamily),
            titleMedium = typography.titleMedium.copy(fontFamily = lexendFontFamily),
            titleSmall = typography.titleSmall.copy(fontFamily = lexendFontFamily),
            bodyLarge = typography.bodyLarge.copy(fontFamily = lexendFontFamily),
            bodyMedium = typography.bodyMedium.copy(
                fontFamily = lexendFontFamily,
                fontWeight = FontWeight.Normal,
                fontSize = 16.sp,
            ),
            bodySmall = typography.bodySmall.copy(fontFamily = lexendFontFamily),
            labelLarge = typography.labelLarge.copy(fontFamily = lexendFontFamily),
            labelMedium = typography.labelMedium.copy(fontFamily = lexendFontFamily),
            labelSmall = typography.labelSmall.copy(fontFamily = lexendFontFamily),
        )
    }
}
c
It's difficult to see exactly what's the cause. Can you share more of the stacktrace that might help shed more light?
e
@Ciaran Sloan Sure, here's the stacktrace
CleanShot 2025-10-05 at 10 .48.02@2x.png