Mercurial > dwindows
changeset 2527:eec926265888
Android: Use toLongOrNull() whenever converting from string to long...
To avoid any possible exceptions.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 10 May 2021 02:24:52 +0000 |
parents | d3f09b3f3703 |
children | 03f6870bcfcc |
files | android/DWindows.kt |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Mon May 10 02:01:28 2021 +0000 +++ b/android/DWindows.kt Mon May 10 02:24:52 2021 +0000 @@ -111,7 +111,7 @@ if (event.x >= v.width - (v as EditText) .compoundDrawables[DRAWABLE_RIGHT].bounds.width() ) { - val newvalue = this.text.toString().toLong() + val newvalue = this.text.toString().toLongOrNull() if(newvalue != null) { value = newvalue + 1 @@ -130,7 +130,7 @@ } else if (event.x <= (v as EditText) .compoundDrawables[DRAWABLE_LEFT].bounds.width() ) { - val newvalue = this.text.toString().toLong() + val newvalue = this.text.toString().toLongOrNull() if(newvalue != null) { value = newvalue - 1 @@ -265,7 +265,7 @@ dialog.show() } - /** + /* * Sort, filter and display the files for the given path. */ private fun refresh(path: File?) {