changeset 2716:a1fea6b9f308

Android: Fix potential null pointer exception in mleSetVisible(). Discovered running emulated on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 05 Dec 2021 16:55:48 +0000
parents e9ad53d2271b
children 43d630b2b37f
files android/DWindows.kt
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/android/DWindows.kt	Sun Dec 05 15:08:13 2021 +0000
+++ b/android/DWindows.kt	Sun Dec 05 16:55:48 2021 +0000
@@ -3019,9 +3019,13 @@
     fun mleSetVisible(mle: EditText, line: Int)
     {
         waitOnUiThread {
-            val y: Int = mle.layout.getLineTop(line)
-
-            mle.scrollTo(0, y)
+            val layout = mle.layout
+
+            if(layout != null) {
+                val y: Int = layout.getLineTop(line)
+
+                mle.scrollTo(0, y)
+            }
         }
     }