Unverified Commit 499601fa authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub

Fix paint nullability for `updateForegroundPaint`/`updateBackgroundPaint` (#936)

It's unconditionally de-ref the pointer that causes crash in case of
nulls


https://github.com/JetBrains/skiko/blob/c66eebc2c23a8b41eb618c715296c2a7dd135f43/skiko/src/jvmMain/cpp/common/paragraph/Paragraph.cc#L206
parent c66eebc2
...@@ -229,7 +229,7 @@ class Paragraph internal constructor(ptr: NativePointer, text: ManagedString?) : ...@@ -229,7 +229,7 @@ class Paragraph internal constructor(ptr: NativePointer, text: ManagedString?) :
* `from` and `to` are ignored by skia * `from` and `to` are ignored by skia
* and change applies to the whole paragraph text * and change applies to the whole paragraph text
*/ */
fun updateForegroundPaint(from: Int, to: Int, paint: Paint?): Paragraph { fun updateForegroundPaint(from: Int, to: Int, paint: Paint): Paragraph {
return try { return try {
if (_text != null) { if (_text != null) {
Stats.onNativeCall() Stats.onNativeCall()
...@@ -253,7 +253,7 @@ class Paragraph internal constructor(ptr: NativePointer, text: ManagedString?) : ...@@ -253,7 +253,7 @@ class Paragraph internal constructor(ptr: NativePointer, text: ManagedString?) :
* `from` and `to` are ignored by skia * `from` and `to` are ignored by skia
* and change applies to the whole paragraph text * and change applies to the whole paragraph text
*/ */
fun updateBackgroundPaint(from: Int, to: Int, paint: Paint?): Paragraph { fun updateBackgroundPaint(from: Int, to: Int, paint: Paint): Paragraph {
return try { return try {
if (_text != null) { if (_text != null) {
Stats.onNativeCall() Stats.onNativeCall()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment