From dbda4174c76a8419ea53a79d034f085b7f03720e Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Thu, 5 Mar 2020 17:49:40 +0300 Subject: [PATCH] `String.toBoolean()` should be `String?.toBoolean()` #KT-14119 (#3946) `String.toBoolean()` should be `String?.toBoolean()` #KT-14119 (cherry picked from commit 3edf880ca0944bc7dc7aaeeae59083f49a6fe0ee) --- .../src/main/kotlin/kotlin/text/StringNumberConversions.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/src/main/kotlin/kotlin/text/StringNumberConversions.kt b/runtime/src/main/kotlin/kotlin/text/StringNumberConversions.kt index 91f483aab70..b11c98be1ab 100644 --- a/runtime/src/main/kotlin/kotlin/text/StringNumberConversions.kt +++ b/runtime/src/main/kotlin/kotlin/text/StringNumberConversions.kt @@ -52,10 +52,11 @@ external internal fun longToString(value: Long, radix: Int): String public actual inline fun Long.toString(radix: Int): String = longToString(this, checkRadix(radix)) /** - * Returns `true` if the contents of this string is equal to the word "true", ignoring case, and `false` otherwise. + * Returns `true` if this string is not `null` and its content is equal to the word "true", ignoring case, and `false` otherwise. */ +@SinceKotlin("1.4") @kotlin.internal.InlineOnly -public actual inline fun String.toBoolean(): Boolean = this.equals("true", ignoreCase = true) +public actual inline fun String?.toBoolean(): Boolean = this.equals("true", ignoreCase = true) /** * Parses the string as a signed [Byte] number and returns the result.