diff --git a/kotlin-native/runtime/src/main/cpp/KString.cpp b/kotlin-native/runtime/src/main/cpp/KString.cpp index 92f82dd0345..51813a00c63 100644 --- a/kotlin-native/runtime/src/main/cpp/KString.cpp +++ b/kotlin-native/runtime/src/main/cpp/KString.cpp @@ -178,7 +178,7 @@ OBJ_GETTER(Kotlin_String_plusImpl, KString thiz, KString other) { // Since thiz and other sizes are bounded by int32_t max value, their sum cannot exceed uint32_t max value - 1. uint32_t result_length = thiz->count_ + other->count_; if (result_length > static_cast(std::numeric_limits::max())) { - ThrowArrayIndexOutOfBoundsException(); + ThrowOutOfMemoryError(); } ArrayHeader* result = AllocArrayInstance(theStringTypeInfo, result_length, OBJ_RESULT)->array(); memcpy(